You should really, really avoid global variables, they are bad(TM).
If you have no other option, create a class with static properties/fields
for each variable you need. For good measure, declare a private constructor
so the class cannot be instantiated.
Everything John said is sensible - although IMHO there are definitely times
when global variables make sense.
But, as evil as it may be, one can still implement a VB Module, which is
roughly the equivalent of a VB6 "General" or BAS module.
It appears that the way .NET treats these is essentially what John
recommends to do - it creates a static (or Shared in VB) entity - which
looks an awful lot like a class - where all routines are automatically also
shared.
Anyone know exactly what a VB Module is ?
Anyway, that is one way to implement global members.
Since I don't know very little about VB your suggestion might be a lot
better than mine.
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.