I’m trying to create an instance of a class to be used throughout the application.
I have two forms: form1 and form2 and I have a class called Singleton1.
I created an instance of Singleton1 in form1 called obTest:
Singeton1 obTest = Singleton1.Instance;
From here I need to access the variable “obTest” from form2. Is it possible to do this?
How I can access that variable without creating a new Singleton1 variable?
Thanks in advance.
If your
Instancemethod is written correctly, then you should be able to call it again inForm2and get a reference to the exact same object that was created inForm1.