Adding Textboxes

10-13-2005, 12:37 PM
Hi Guys,

I have in my quote program, there are 4 labels

Lets Just say
Label1, Label2, Label3, Label4

How can I add the value of them together?

Thank you

10-13-2005, 12:47 PM
If you mean they are numbers and you want to sum them all:

Val(Label1.Text) + Val(Label2.Text) + Val(Label3.Text) + Val(Label4.Text)

If you want to concatenate the strings:

Label1.Text& Label2.Text& Label3.Text& Label4.Text

edit: Thanks for the correction John, I forgot where I was. Also, use Convert.ToInt32() instead of Val() in .NET.

10-13-2005, 02:58 PM
.Net Labels don't have a Caption property. It would be Label1.Text etc.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum