I know it's not possible to create a global variable in C# but what I want is to declare a variable on form1, assign it a value and use this variable on form2.
How do I do that ???
How to create a "global" variable ?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Jul 29, 2012, 4:51 AM EDT
class Form1 : Form
{
internal static MyInt;
public Form1()
{
InitializeComponent();
MyInt = 42;
}
// etc
}
// code to access this variable from Form2:
int i = Form1.MyInt;
alok singh13 reputationPosted Jul 29, 2012, 1:40 AM EDT
Waqas Ali16 reputationPosted Jul 29, 2012, 2:43 AM EDT