Archived

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

VB Variable Access

This topic is 5146 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

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" 

or
form1.lstList.Clear 

Share this post


Link to post
Share on other sites