Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Adding Textboxes


Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2005, 11:37 AM
ShawnMichaels ShawnMichaels is offline
Regular
 
Join Date: Sep 2004
Location: Connecticut
Posts: 53
Default Adding Textboxes


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
__________________
--Shawn M--
Echo Sierra Charlie Tango
Reply With Quote
  #2  
Old 10-13-2005, 11:47 AM
Volte's Avatar
Volte Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,343
Default

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.

Last edited by Volte; 10-13-2005 at 02:11 PM.
Reply With Quote
  #3  
Old 10-13-2005, 01:58 PM
John's Avatar
John John is offline
Bit Flipper
 
Join Date: Feb 2002
Location: The Inner Loop
Posts: 5,550
Default

.Net Labels don't have a Caption property. It would be Label1.Text etc.
__________________
Subclassing|Magnetic Forms|Operator Overloading (VB2K5)|QuickSnip.NET

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->