View Single Post
  #4 (permalink)  
Old July 18th, 2007, 01:52 PM
David_0223 David_0223 is offline
Authorized User
 
Join Date: Nov 2006
Location: Valparaiso, IN, USA.
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

You must have a main class that launches your application such as Program.cs. If you add a private static variable and a public statuc 'get' property to that class it will be available throughout your application.

I.E. :

static class Program {
  ...
  static private string m_UserCode = "";
  ...
  static public string UserCode {
    get {
      return m_UserCode;
    }
  }
} // end of class Program

You can set the variable from within class Program but have a read only global value available.

If you need to set the UserCode from another class you could do it if you made the variable protected.



What you don't know can hurt you!
Reply With Quote