none
How do I incorperate this math formula in C# RRS feed

  • Question

  • What im trying to do is use this formula in my Program

    (10*1*(3+(X/2))*Y)/60

    What im trying to do is make textbox 1 where x goes and textbox 2 where y goes and process this

    i keep getting errors and im just wondering if anyone can help thanks!

    Thursday, November 27, 2014 3:45 AM

Answers

  • Here the code for you

     int X, Y;
                double result = 0;
    
                if (int.TryParse(textBox1.Text, out X) && int.TryParse(textBox2.Text, out Y))
                {
                    result = (10 * 1 * (3 + (X / 2)) * Y) / 60;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please input number into textboxes !");
                }           

    Thursday, November 27, 2014 7:08 AM

All replies

  • Show us your code and the errors that you are getting.
    Thursday, November 27, 2014 4:35 AM
  • Here the code for you

     int X, Y;
                double result = 0;
    
                if (int.TryParse(textBox1.Text, out X) && int.TryParse(textBox2.Text, out Y))
                {
                    result = (10 * 1 * (3 + (X / 2)) * Y) / 60;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Please input number into textboxes !");
                }           

    Thursday, November 27, 2014 7:08 AM