Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

declaring global variables in VB.Net

Status
Not open for further replies.

shaminda

Programmer
Jun 9, 2000
170
US
In visual basic 6 I use a module to declare my public variables. Say in my module called modMain I have the following
Public strPartNumber as String

I initialize this variable in say Form1 as follows
strPartNumber = 45

I can access this value in Form2 by the foloowing code
txtPartNumber.Text = strPartNumber

How do I do the same thing in VB.Net? I am sure there are tons of way to do this, what is the most efficient way? I am thinking about declaring all my public variables in a class called cBaseForm. Code will also be helpful.

 
In a class use "Public Shared s As String." In a module, do it the same way as VB6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top