I want to ask you about public variable,
the case is, if i have 2 form in my application, and in form 1, i declared public variable or public component visual C#, and i doing something with the variable, for an example, i give a variable value :
class TestVariable
{
public int a;
private void Test()
{
if (checkbox1.checked == true)
{
a = 10;
}
}
}
i give a value in variable a in form 1, and after that i go to form 2, and if i want to use the value in variable a, which is the value is 10, how can i get the value without change to default value? because i can't get value 10 in variable a, can you help me?
this is my code to access variable value in form 1 :
int b; TestVariable form = new TestVariable(); b = form.a;
This post has been edited by michaeltjia: 06 November 2008 - 07:24 PM

New Topic/Question
Reply




MultiQuote



|