I'm trying to add multiple values and total them in one textbox from different button clicks. For example I have textBox1 and 5 labels + 5 buttons. I want to be able to click button one and it adds the value from label1 to textBox1 then if I click button2 it will add the value from label2 to textBox1.
I can get it to work once but when I try to add more totals to textbox1 from different buttons it clears the total? what the best way of doing this function?
Loading
VulpesPosted Aug 22, 2011, 12:48 PM
VulpesPosted Aug 22, 2011, 1:59 PM
mike DelvottiPosted Aug 22, 2011, 12:59 PM
double result = Double.Parse(textBox1.Text) + Double.Parse(label1.Text);
textBox1.Text = result.ToString("F2");
But your answer looks much better as my above version doesn't allow for input errors.