Jump to content

Welcome to Geeks to Go - Register now for FREE

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
Photo

Vb 6 help


  • Please log in to reply

#1
Gamer2bn

Gamer2bn

    Member

  • Member
  • PipPip
  • 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

Advertisements


#2
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 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

Gamer2bn

    Member

  • Topic Starter
  • Member
  • PipPip
  • 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

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 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

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP