It's the same principle in C#, but you will need to pass the Form1 object to Form2 and change the Modifiers property of any control that you want to access from Privater to Internal. HTH --Sam
You can also create an event in Form2 that Form1 could fire whenever something changes. That is much more complecated, but easily done. If that is what you want, you should tell us whether you are using 2003 or 2005.
Here is the code for Form1:
- private void button1_Click(object sender, EventArgs e)
-
{
-
Form2 FrmChild = new Form2(this);
-
FrmChild.Show();
-
}
Here is the code for Form2. Notice that the constructor is overridden to get the Form1 object:
- private Form1 FrmParent;
-
public Form2(Form1 parent)
-
{
-
InitializeComponent();
-
FrmParent = parent;
-
}
-
private void button1_Click(object sender, EventArgs e)
-
{
-
this.textBox1.Text = FrmParent.textBox1.Text;
-
}
-
-