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();
}
}
suman kumarPosted Aug 17, 2013, 6:52 AM
thing is GT has to update in text box automatically just like total..I just made little adjustment now its working...
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 = "";
textBox6.Text += Convert.ToDouble(textBox5.Text);
}
}
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 = "";
textBox6.Text += Convert.ToDouble(textBox5.Text);
}
}
suman kumarPosted Aug 17, 2013, 6:32 AM
Sanjeeb LenkaPosted Aug 17, 2013, 6:24 AM
private void textBox3_TextChanged(object sender, EventArgs e)
{
if (textBox3.Text != string.Empty && textBox4.Text != string.Empty)
{
textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
}
if (textBox5.Text != string.Empty && textBox6.Text != string.Empty)
{
textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();
}
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
if (textBox3.Text != string.Empty && (textBox4.Text != string.Empty)
{
textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
}
if (textBox5.Text != string.Empty && textBox6.Text != string.Empty)
{
textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();
}
}
share your full code with cs. so we can get a clear idea