Creating Application Level variable

Posted by Raj.Trivedi under C# category on | Points: 40 | Views : 996
Hello Team,

Over here we will be checking how to create a application level variable.

Create a Class named Property in that declare the following property.

static class Properties
private static string m_globalVar = "";
public static string GlobalVar
get { return m_globalVar; }
set { m_globalVar = value; }

Now in the Form where you want to set the value to use it in the entire application.

GlobalVar = "Assign value to the variable"

Now use it in any other form

Label1.text = GlobalVar

Comments or Responses

Login to post response