I have an MDI form and several number of child forms inside that MDI. On clicking a button in the menu, a form opens. If another form is already open then that should get minimized and the new from should open. The problem is even if i give frm.WindowState=WindowState.Minimized, the form does not get minimized. The code that I have written is given below,
frmReaserchData childForm = null;
foreach (Form f in this.MdiChildren)
{
if (f is frmReaserchData)
{
// found it
childForm = (frmReaserchData)f;
break;
}
else
{
f.WindowState = FormWindowState.Minimized;
}
}
if (childForm != null)
{
childForm.Focus();
}
else
{
childForm = new frmReaserchData();
childForm.MdiParent = this;
childForm.Show();
}