I need something to know please help me.
Can I use the code in textbox??
For Ex:
I have a textbox (Name: code) to write the code and two other to enter values.
I write these in my first textbox :
Convert.ToDouble(value1.Text)+ Convert.ToDouble(value2.Text);
and when i click the button I want it to be calculated. and see the result as a string on a laber or whatever.
I read soo much articles but still I cant do it. Please help me. Thanks to all.

FroglegPosted Oct 31, 2013, 4:00 PM
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox2.Text != string.Empty)
{
double d = Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text);
label1.Text = d.ToString();
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text != string.Empty)
{
double d = Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text);
label1.Text = d.ToString();
}
}
Guest UserPosted Oct 31, 2013, 4:04 AM
FroglegPosted Oct 30, 2013, 3:45 PM
private void button1_Click(object sender, EventArgs e)
{
double d = Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text);
label1.Text = d.ToString();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && e.KeyChar != 8)
{
e.Handled = true;
}
//allows only numbers and backspace
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && e.KeyChar != 8)
{
e.Handled = true;
}
//allows only numbers and backspace
}