i m in a frm and i want to its previous frm
how to go to previous form inC#.net
Collapse
X
-
Tags: None
-
-
assuming 2 forms : Form1 and Form2
to move from Form2 to previous Form1:
Code://code in Form1 Form2 f2 = new Form2(this); this.Hide(); f2.Show(); //code in Form2 Form f1; //global member public Form2(Form1 f1) //constructor { InitializeComponents(); this.f1 = f1; } button_Click(o s,ea e) { this.Close(); f1.Show(); }
Comment
-
You could show form 2 using ShowDialog() instead of Show(). This would bring execution back to form 1 after form 2 has closed.Comment
Comment