0
Hi just go through code, It will make sure that, u r having only one instance..
frmChild childForm = null;
foreach(Form form in this.MdiChildren)
{
if(form is frmChild )
{
childForm = (frmChild)form;
break;
}
}
if( childForm != null)
{
childForm.Show();
childForm.Focus();
}
else
{
childForm = new frmChild();
childForm .MdiParent=this;
childForm .Show();
childForm .Focus();
}
Here frmChild is the child form, in foreach loop just checks for the instance of that frmChild,if found show that one, else create new instance of child...
If u find difficulty in understanding the above.. just mess me again.
Cheers
soman
0
hi,
thank u simon.
but problem is not u said to me.
see i m telling u my steps.
in mdi form
i have menu file.
in that sub menu new.
now when i click on new option child form opens.
now keep in mind i m not closeing child form.
i again click new option & the result is.
i got another instance of child form. so on my screen 2 child forms appers.
i want if 1 instance is open then another can't be open.
please guide me.
thank u,
bhavin
0
Hi
Create child form once (in constructor or pageload).
Then in menu only make show, and in child form do not close, but hide it.
Simon