Add a new class.cs file to the project and then
static class GlobalClass
{
private string m_globalVar = "";
public static string GlobalVar
{
get { return m_globalVar; }
set { m_globalVar = value; }
}
}
Use it anywhere like this
GlobalClass.GlobalVar = "the_value_you_waant_to_put";
Access it anywhere like this
myFormLabel.Text = GlobalClass.GlobalVar;
Enjoy C#
No comments:
Post a Comment