Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
what can i do ,for addition of two textbox values and result in lable and then label value should be added to next addition of textboxes on button click event with double data type in windows c#.net
Posted

1 solution

It's pretty easy:
C#
double d1 , d2, l1;
if (!double.TryParse(textbox1.Text, out d1)) throw new ArgumentException("Text box 1 needs to be numeric");
if (!double.TryParse(textbox2.Text, out d2)) throw new ArgumentException("Text box 2 needs to be numeric");
if (!double.TryParse(label1.Text, out l1)) throw new ArgumentException("Label 1 needs to be numeric");
label1.Text = (d1 + d2 + l1).ToString();
 
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