Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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