anyone can tell me what i had did wrong since my code wont do anything at all i am pretty new to WPF i had mostly only maded in C# and VB.Net
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Omini_Tires_And_rims
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Beregn_Click(object sender, EventArgs e)
{
if (validation())
{
float value1, value2, result = 0;
value1 = float.Parse(bredebox_nu.Text);
value2 = float.Parse(profilbox_nu.Text);
result = value1 * value2;
Profilhøjdelabel_nu.Content = result.ToString();
}
}
bool validation()
{
if (bredebox_nu.Text.Trim() != "")
{
try
{
float value1 = float.Parse(bredebox_nu.Text);
}
catch
{
MessageBox.Show("indsæt kun tal i nuværende brede");
return false;
}
}
else
{
MessageBox.Show("Nuværende Størelse Brede skal ikke være tom");
return false;
}
if (profilbox_nu.Text.Trim() != "")
{
try
{
float value2 = float.Parse(profilbox_nu.Text);
}
catch
{
MessageBox.Show("indsæt kun tal i nuværende profil");
return false;
}
}
else
{
MessageBox.Show("Nuværende Størelse Profil skal ikke være tom");
return false;
}
return true;
}
}
}