Accessing a global variable on Multiple forms

  • Thread starter Kevin Humphreys
  • 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.
 
S

Steve

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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top