Try this code on Window(Form) Open Events it will close open form and open new form/window........
var form1 = new Formname();
var openedForm = Application.OpenForms[form1.Name];
if (openedForm != null)
{
openedForm.WindowState = FormWindowState.Normal;
openedForm.BringToFront();
openedForm.Activate();
}
else
{
// If required.
form1.MdiParent = this;
form1.Show();
}
var form1 = new Formname();
var openedForm = Application.OpenForms[form1.Name];
if (openedForm != null)
{
openedForm.WindowState = FormWindowState.Normal;
openedForm.BringToFront();
openedForm.Activate();
}
else
{
// If required.
form1.MdiParent = this;
form1.Show();
}
No comments:
Post a Comment