Results 1 to 10 of 28

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #27
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by Paul View Post
    Well this worked for me.

    Code:
            public void button1_Click(object sender, EventArgs e)
            {
                int firstbox = Int32.Parse( textBox1.Text ); //here you input first value
                int firstvalue = Int32.Parse( textBox1.Text ); // this is to store the first value you write in textbox
                int secondbox = Int32.Parse(textBox1.Text);  //second input!
                int secondvalue = Int32.Parse(textBox1.Text); //this is to store the second value that you input after buttonclick
                int result = firstbox + secondbox; //the sum
                int limitbox = Int32.Parse(textBox2.Text); //limit!
    
                textBox1.Text = ""; //this is so that the textbox clears after the click
    
                if (result <= limitbox)
                { //if you only write < and the MAX is 20, it will give you Invalid because 20 is not less than 20
                    textBox1.Text = result.ToString();
                }
                else
                {
                    MessageBox.Show("Invalid input");
                }
    
            }
    YESSS it worked! i changed it a bit. Thank you very much Paul and yes you too yung and the other people for replying and trying to help /request lock
    Code:
     private void button_Click(object sender, RoutedEventArgs e)
            {
                int firstbox = Int32.Parse(textBox1.Text); //here you input first value
                int secondbox = Convert.ToInt32(label.Content);  //second input!            
                int result = firstbox + secondbox; //the sum
                int limitbox = Int32.Parse(textBox2.Text); //limit!
    
                textBox1.Text = ""; //this is so that the textbox clears after the click
    
                if (result <= limitbox)
                { //if you only write < and the MAX is 20, it will give you Invalid because 20 is not less than 20
                    label.Content = result.ToString();
                }
                else
                {
                    MessageBox.Show("Invalid input");
                }
            }
    Last edited by qais187; 10-17-2015 at 11:52 AM.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)