增加两个数字 [英] Addition of two numbers
本文介绍了增加两个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在第三个文本框中看到从两个文本框中添加两个数字。 pl,帮帮我。
How can i see the addition of two numbers reading from two text boxes in the third text box. pl, help me.
推荐答案
在Windows窗体上添加三个文本框。
然后使用类似下面的代码 -
textbox3.Text = Convert.ToDecimal(textbox2.Text)+ Convert.ToDecimal(textbox1.Text);
Add three text boxes on a windows form.
Then use code similar to following -
textbox3.Text = Convert.ToDecimal(textbox2.Text) + Convert.ToDecimal(textbox1.Text);
轻松。
第1步。使用double.Parse()
阅读两个文本框中的文本。您可能想要使用double.TryParse()
以便处理无效输入。
步骤2。添加两个双打
第3步。在第三个文本框中显示文字。
尝试谷歌搜索double.Parse()
如果你以前从未使用过它; - )
Easy.
Step 1. Usedouble.Parse()
to read the text in the two textboxes. You may want to usedouble.TryParse()
so you can handle invalid inputs.
Step 2. Add the twodoubles
Step 3. Display the text in the third textbox.
Try googlingdouble.Parse()
if you have never used it before ;-)
这篇关于增加两个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文