I will appreciate if anyone can help me on this.
I have a windows form app that has three forms: form1, form2, form3. form1 starts when the app is activated. on form1, there is a button that brings up form2, and hide form1. there is also one button that brings up form3 and hides form2 on form2.
public partial class Form1 : Form
{
Form2 f2= new Form2();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
f2.Show();
}
}
public partial class Form2 : Form
{
Form3 f3 = new Form3();
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
f3.Show();
}
}
The question is on form3, i tried to access some of the variables that are assigned with values on runtime in form2. I think since i make f2 as modaless form, i should be able to access by simply using f2.myvariables, but the intellisense does not give me f2 object. Why is that? I found a way to declare those variables public static, so i could access by using form2.myvariables..Here is another thing that confuses me. Since all the values are assigned during runtime, how could static variable do this? I am a newbie on C#, and i already did a lot of searches on this, but seems no place answers my question exactly. Thanks for help in advance!!