Accessing a global variable on Multiple forms

  • Thread starter Thread starter Kevin Humphreys
  • Start date Start date
K

Kevin Humphreys

Hi There,
What's the best method and syntax to access a global boolean variable
between multiple forms on VB.NET?

Thanks,
Kevin.
 
This may be a C# only response, but hopefully not. A boolean needs to live
in a class with .Net, so you need a class to hold it, you can then make that
class a Singleton, or you can make the bool static so that you can access it
without an instance of the class (IE: CMyClass.MyBoolean)

Those are the 2 cleanest ways assuming you don't have an Application
"Engine" class or "Model" class. You could also make the bool a static
member of one of the forms, then the other ones can get to it but that
design is pretty ugly IMHO....
 
Back
Top