将4个文本框中的值相乘,并在第5个中显示答案 [英] Multiply the values in 4 textboxes and show answer in 5th
问题描述
你好:)
我如何将4个文本框中的值相乘并在第5个文本框中显示答案?用户将输入值,按下按钮后,答案将显示在第5个文本框中。
例如:
[In textbox1]:300000
[在textbox2中]:10
[在textbox3中]:20
[在textbox4中]:0.18
[[[MULTIPLY]]]
[在textbox5中]:答案
非常感谢提前!
我尝试了什么:
我已经尝试了所有的单个文本框中的值(所以基本上只是一个计算器),但我不知道如何做到这一点:(
我试过在线查看,但它没有显示任何太相关的我的问题。
原理完全一样:
1)从文本框中读取一个值。
2)使用Int.TryParse或Double.TryParse将其转换为适当的数字格式。
3)乘以总数。
4)继续下一个TextBox。
5)当所有的四个r被处理,使用ToString将总数转换回字符串,并在第五个TextBox中显示。
如果你用1开始你的总数,它将起作用
hello :)
How would I multiply the values in 4 textboxes and show the answer in a 5th textbox? The user would input the values and, upon button press, the answer would show in a 5th textbox.
For example:
[In textbox1]: 300000
[In textbox2]: 10
[In textbox3]: 20
[In textbox4]: 0.18
[[[MULTIPLY]]]
[In textbox5]: ANSWER
Thanks a lot in advance!
What I have tried:
I've tried it with all of the values in a single textbox (so basically just a calculator), but I have no clue how to do it like this :(
I've tried looking online but it didn't show anything too relevant to my problem.
The principle is exactly the same:
1) Read a value from a text box.
2) Use Int.TryParse or Double.TryParse to convert it to the appropriate number format.
3) Multiply a total by it.
4) Move on for next TextBox.
5) When all four are processed, use ToString to convert the total back to a string, and display it in the fifth TextBox.
Provided you start your total with 1, it will work.
这篇关于将4个文本框中的值相乘,并在第5个中显示答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!