Jump to content
  • Advertisement


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


VB Variable Access

This topic is 5515 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!