Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


VB Variable Access

This topic is 5434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In VB6, how do you access a variable that''s on another form? Is this at all possible. I know you can access interface objects using !, but I can''t seem to get it to work for variables.

Share this post

Link to post
Share on other sites
The variable must be assigned to public in the form in which it is used (and should also be declared in General Declerations (up the top)) to ensure that it can be seen from elsewhere in your program.

To assign a value to your variable:
formname.variablename = value 

To retrieve a value from your variable:
another variable = formname.variablename 

You can also access the properties and methods of the form itself in this way, as well as the properties and methods of any controls on the form. eg.
form1.txtname.text = "value" 


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!