J
js
Hello,
I have two text boxes accepting ints and displaying their Sum.
This code works:
string ans;
ans = Convert.ToString(Convert.ToInt32(textBoxX.Text) +
Convert.ToInt32(textBoxY.Text));
labelAnswer.Text = ans;
But this code generates InvalidCastException:
labelAnswer.Text = Convert.ToString( Convert.ToInt32(textBoxX.Text) +
Convert.ToInt32(textBoxY) );
Why? What's the difference?
brad.
I have two text boxes accepting ints and displaying their Sum.
This code works:
string ans;
ans = Convert.ToString(Convert.ToInt32(textBoxX.Text) +
Convert.ToInt32(textBoxY.Text));
labelAnswer.Text = ans;
But this code generates InvalidCastException:
labelAnswer.Text = Convert.ToString( Convert.ToInt32(textBoxX.Text) +
Convert.ToInt32(textBoxY) );
Why? What's the difference?
brad.