2
Reply

How do I close the child window without closing the whole application in windows forms..?

Suraj Tadge

Suraj Tadge

11y
2.2k
0
Reply

    private void button1_Click(object sender, EventArgs e){Form2 frm2 = new Form2();frm2.FormClosed += new FormClosedEventHandler(frm2_FormClosed);frm2.Show();this.Hide();}private void frm2_FormClosed(object sender, FormClosedEventArgs e){this.Close();}try This this might be helpful

    Hi Suraj, try this List openForms = new List(); foreach (Form f in Application.OpenForms) openForms.Add(f); foreach (Form f in openForms) { if (f.Name != "Menu") f.Close(); } i hope this will help you. let me known