增加两个数字 [英] Addition of two numbers

查看:94
本文介绍了增加两个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在第三个文本框中看到从两个文本框中添加两个数字。 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. Use double.Parse() to read the text in the two textboxes. You may want to use double.TryParse() so you can handle invalid inputs.
Step 2. Add the two doubles
Step 3. Display the text in the third textbox.

Try googling double.Parse() if you have never used it before ;-)


这篇关于增加两个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆