locked
How to define a global variable? RRS feed

  • Question

  • Hi,

    I want to define a global variables which can store information and can be accessed accross all the forms and classes in my application. While loading the application, I would like to set this once and then use it throughout my application. How to do this?

    Regards,
    Eitan
    Friday, March 16, 2007 8:05 PM

Answers

  • public static class MyGlobalVariables {

    public static int MyGlobalInt = 10;

    }

     

    MyGlobalVariables.MyGlobalInt = 5;

     

    Saturday, March 17, 2007 12:14 AM

All replies

  • public static class MyGlobalVariables {

    public static int MyGlobalInt = 10;

    }

     

    MyGlobalVariables.MyGlobalInt = 5;

     

    Saturday, March 17, 2007 12:14 AM
  • Thanks,

    Eitan

    Monday, March 19, 2007 8:00 PM