Global data in vb.net

venAdder

New member
Joined
Jul 10, 2005
Messages
4
Programming Experience
1-3
Hi,

I am starting my MDI app using sub main. I want a object of a class i created to be available to all classes and forms in my app( kinda like static ). This object is gonna be constructed in the sub main , before naythign else happens.

Is there sth like global space or a way to achieve this?
 
add a module to the project and in there declare all application wide variables as Friend:

VB.NET:
Option Explicit On
Option Strict On

Module Module1
  Friend StringVariable As String
  Friend IntegerVariable As Integer
End Module

then you just use the variable like all other variables
 
Back
Top