Navigation b/n forms
Hi everyone, I got a problem while navigating between forms.
I have 3 forms namely form1,form2,form3
form1 is parent of form2.
form2 is parent of form3.
here I want to display form1 always .....
and from form1, I ll call form2.
then from form2, I ll call form3 at that time my form2 should hide and form3 should appear ...
In form3, I have a cancel button... if i click that btn my form2 should appear and form3 should close and note that
during al these process my form1 should be appear in the background.(but its not active till its child form i.e form2 completely closes)
please help me out to do this
Kirtan PatelPosted May 11, 2009, 3:35 PM
Form1 Form2 Form 3
in Each Form Take One Button Say
"OpenForm2 Button in Form1"
in Form2 say Button "OpenFrom3
and in third Form "Cancel Button"
in Form1 's Button Click Event Write Code Like bellow
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
}
then in form2's Button Click Event
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
Form3 f3 = new Form3();
f3.ShowDialog();
}
and Finaly in Form3's Cancel Button Click Event Write Code
private void button1_Click(object sender, EventArgs e)
{
FormCollection fc = Application.OpenForms;
foreach (Form f in fc)
{
if (f.Name == "Form2")
{
f.Show();
}
}
this.Dispose();
}
If you don't Understand any thing Above take a Look at my Coded Project Files
Download From Here
http://www.mediafire.com/?q1gozdmwjyj
Happy Coding :)
mohanPosted May 12, 2009, 1:57 AM