Results 1 to 2 of 2

Thread: [RESOLVED] wont fire up at all

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    123

    Resolved [RESOLVED] wont fire up at all

    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;
            }
        }
    }

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    123

    Re: wont fire up at all

    had to make a new from the scratch and then it worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width