Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

# Vb 6 help

### #1 Gamer2bn Posted 24 August 2005 - 04:04 PM

Gamer2bn

Member

• Member
• 48 posts
I want to make a formula that will take the "caption" of two "labels" which will both be numerical and add them together and change a caption of another label on another form to the sum ... how would i go about doing that keep in mind im a vb noob so i dont understand much

added: i no how to change the part on the other form i just need to know how to add really

Edited by Gamer2bn, 24 August 2005 - 04:05 PM.

• 0

### #2 darth_ash Posted 25 August 2005 - 09:00 AM

darth_ash

Member 1K

• Member
• 1,382 posts
The Caption of a Label is a string; to do mathematical operations on it, you will need a numerical datatype.
You will have to convert the the string by using the Val function to a numerical data-type.
e.g (Consider x as a defined variable with a numerical data-type like Double or Integer, etc..):
x = val(label1.caption)
• 0

### #3 Gamer2bn Posted 25 August 2005 - 02:41 PM

Gamer2bn

Member

• Topic Starter
• Member
• 48 posts
... I'm sorry so would the correct way to do it be

label.caption = val(label.caption) + val(form2.label.caption)

or would i have to make a variant? ive tried using the var thing a million different ways i still cant seem to make it work

I appologize for being a bother...
• 0

### #4 darth_ash Posted 25 August 2005 - 02:44 PM

darth_ash

Member 1K

• Member
• 1,382 posts

label.caption = val(label.caption) + val(form2.label.caption)

No.
The label.caption on the LHS needs a string.
so it should be:

label.caption = Str((val(label.caption) + val(form2.label.caption))
• 0

### Similar Topics

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users