suman kumar

suman kumar

  • NA
  • 26
  • 23.4k

total and grand total code using text box

Aug 17 2013 6:14 AM

hi

this is my code and I am trying to write a simple code to generate total and grand total.
I have id,name,quantity,price,total,grand total
'total' works perfectly,but I am having problem getting GT to work.
here is the code....
the error I am getting is "Input string was not in correct format"

private void textBox3_TextChanged(object sender, EventArgs e)

        {

            if ((textBox3.Text != "") && (textBox4.Text != ""))

            {

                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();

                textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();

            }

        }


        private void textBox4_TextChanged(object sender, EventArgs e)

        {

            if ((textBox3.Text != "") && (textBox4.Text!=""))

            {

                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();

                textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();

            }

        }


Answers (3)