form A opens form B, and form A.visible = false;
form A has a public int variable and I need controls in form B to be able to access and modify this variable. could this be done as passing the value through the constructor is only one way!
and so if it could be done, if form A is not visible could the value still be accessed?
(form b is not supposed to be dialog!)
many thanks!
edited: I do not quite get the explanations actually. so far it is like that:
in form a:
//in global space
public int temp = 123;
//in form_load event
Form setup = new setup();
setup.Show();
this.Visible = false;
in form setup:
//in form_load event
textBox1.text = temp.toString();
//in button_press event
form a.temp = "456";
I hope I have explained my stance clearly!
First, have member field in form B of type form A:
Second, have such constructor in form B:
Now when you create instance of form B, pass reference to the running form A instance:
And you can access the public property through the
parentfield e.g.