Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Initializing global variables
I've got a class called Initializer that I use the initialize global variables. It has properties that allow other classes to retrieve these variables.
Here's my problem: I must create an instance of this class to initialize everything. I suppose the best place to do that would be in the very first form that loads, mine's called "MainMenu()". Thing is, as I transfer control to other forms, I dispose of those I don't need anymore so I don't waste resources. Does my instance of Initializer() get destroyed when I dispose of the form that created it?
How do you initialize global variables, and how do you access them? I tried just making a variable Public, thinking that all classes everywhere could access it, but other classes don't seem to recognize it. And I don't see anything like main() or winmain() in a windows forms application, so I have no idea where to stick these variables.
Yeah, I am new to VB.NET, but please help!! Thanks a bundle. If you help me now, I promise to give you a million dollars when I am a multi billionnaire like Bill Gates.
0 · ·