Click here to Skip to main content
15,844,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
[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.
Updated 27-Oct-17 21:07pm
Graeme_Grant 27-Oct-17 21:24pm    
We can't see your screen from here... Where is the code that you have written so far?

Please update the question with clear and concise details, sample code, any error messages (including inner exception details), etc, by clicking on the Improve question widget.
Karthik_Mahalingam 28-Oct-17 5:37am    
win or web ?
show the code.

1 solution

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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900