I have two forms Form1
and Form2
I am opening Form2
from Form1
on button_Click
Form2 obj2 = new Form2();
this.Visible = false;
obj2.Show();
then I want to get back Form1
Visible (on disposing Form2
) in same states of Controls on which I left.....
Your Form2
doesn't know anything about Form1
. It will need a reference to it (you can do that by adding a Form
type property on Form2
and assign Form1
to it after construction):
//In Form2
public Form RefToForm1 { get; set;}
//In Form1
Form2 obj2 = new Form2();
obj2.RefToForm1 = this;
this.Visible = false;
obj2.Show();
//In Form2, where you need to show Form1:
this.RefToForm1.Show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With