+ 1
About TextBox in C#
Hello guys.. My question is what's difference of : int x = Convert.ToInt32(textBox.Text); and textBox1.Text = Convert.ToString(int x); In this case, I using that statement for sum two value in textBox.... Please help me... Thanks a lot Regards
5 ответов
+ 2
You want to sum two values, so you should have two text boxes, am I right?
+ 2
label1.Text = Convert.ToInt32(textbox1.Text) + Convert.ToInt32(textbox2.Text);
You need to convert to Int for arithmetic addition.
+ 2
You are welcome
Basically you need four Controls in your Graphical Interface : two input box, one display box (Label named label1) and a button.
Put the above in a click function of button.
The conversion is because input are string. For output, string and numbers both ok.
For convert int, you can only process integers. Convert to float if you want to extend the coverage to decimal numbers.
You may want to add two lines to empty the input text boxes after calculation.
0
Yes, you are right....
0
Nice answer....
Ok sir...I will try it