Question

I have a mdi parent form and I open my other forms in run time as mdi child form by this code:

private void MenuItem_Click(object sender, EventArgs e)
{
    childform = new childform ();
    frm.MdiParent = Mdiparent;
    frm.WindowState = FormWindowState.Maximized;
    frm.Show();
}

but the problem is: When current form is open, user can open another form and it can be repeated several times so that each form is opened what's code for closing the current child form before user open a new child form??

Was it helpful?

Solution

tanx for ur assist :) I Found effective code by test other Members in Class Windows.forms just enough check this :

if (ActiveMdiChild != null)
    ActiveMdiChild.Close();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top