| Author: Anuraj 02 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Declare it in the Program.cs, as static members, then you can access it anywhere using Program.Field.
Thanks Anuraj THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS. BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT. dotnetthoghts
|
| Author: ABitSmart 02 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Declare it as Public. You can then access it anywhere in your application. If it is declared in a DLL you will need to add reference of the DLL.
Anuraj, How would static make it accessible globally?
Kind regards, ABitSmart DNS Web-master, DNS MVM My blog Thoughts.exe
|
| Author: Anuraj 03 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
@ABitSmart : Put the static variable in Program.cs, then you can access it globally. As per my understanding the question is about creating a Application variable. If I create a Public variable in anywhere in the application, I need to create the instance of the class to access that variable right? If I create the instance of a class, it will be a fresh copy. Please let me know if I am wrong.
Thanks Anuraj THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS. BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT. dotnetthoghts
|