Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am having two text box in my form....giving the values for the 2 text box ....it gets added...after that the updated sum value ,should be placed in the first textbox...how to do...please help be with coding logic
Posted

This smells heavily of homework, so you get no code!

It's pretty easy though:
1) Read the contents of the first TextBox (use it's Text property)
2) Convert it to an integer, using the int.Parse[^] method.
3) Do the same for the second TextBox
4) Add the two integers together, and save the result in a third integer.
5) Set the Text property of the first TextBox to the result using the ToString method: result.ToString() will do it.
 
Share this answer
 
Comments
LanFanNinja 3-Feb-12 3:54am    
+5
Dear Friend,

Your question is that on the focus lost of second textbox, you want the sum of value of two textboxes to be added and show it into the third box, If this is what you require then the solution is:-

After writing the Value in the second text box, on the <b>onblur</b> event of second text box you can call a javascript function which will hence add the value of two texboxes and shows it into the third textbox.

Hope this will help you out.

Thanks
 
Share this answer
 
v2

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