If what you want to achieve is opening a form only if it isn't already open, then bring it on front when it is, then the following code might help.
private void tsmiMenuOption_Click(object sender, EventArgs e) {
// Assuming this method is part of an MDI form.
foreach(Form child in this.MdiChildren)
if (child.Name == MyForm.Name) {
child.BringToFront();
return;
}
MyForm f = new MyForm();
f.MdiParent = this;
f.Show();
}
So, this is untested pseudo-c#-code that verifies if MyForm is already opened and contained in the MdiContainer.Children
. If it is, then it brings this form (MyForm
) to the front. If it is not, then it simply instantiate and opens it.
Is this about what you want?