How to declare a global variable in c# window application which is accesseble in all windows form?
please help me.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Jan 16, 2010, 10:28 AM
like if you want to declare global variable in form1 that will be accessible to all form then
in form1
declare variable oud side of all methods in form1 like
public static int global_var;
now you can access it at an other form like
int test = Form1.global_var ;
without creating even instance of Form1.
if my answer helps you then check "Do you like this answer" check box :)
Kirtan PatelPosted Jan 17, 2010, 2:28 AM
Vikas AhlawatPosted Jan 16, 2010, 10:43 AM