Reputation: 45
I have 3 forms. We can enter to form2 through form1.(Then form1 will disappear.) When we close form2, form1 will reappear. Similarly we can enter to form3 through form2.(Then form2 will disappear.) When we close form3, form2 should reappear.(This is the part where I fail.)
When I close the form3, the form which appear is the form1 instead of form2. (same instances have to reappear. 'Creating new object of form and make it appear' is not allowed :) )
Please help.
code in form1:
this.ShowInTaskbar = false;
this.Visible = false;
Form2 f2 = new Form2();
f2.ShowDialog();
this.Visible = true;
this.ShowInTaskbar = true;
code in form2:
this.Visible = false;
this.ShowInTaskbar = false;
Form3 f3 = new Form3();
f3.ShowDialog();
this.Visible = true;
this.ShowInTaskbar = true;
Upvotes: 0
Views: 59
Reputation: 16277
Not sure, but try make form2's parent be form1:
form2.Parent=form1;
or
f2.ShowDialog(form1);
Upvotes: 1