Hi,
I've got this child form that when i try to check it in main form if (chldfrm.ShowDialog() == DialogResult.OK, and if true the child form is shown again. Though the passed value from child form into the main form is shown after the child form appears. Can any one help?
Thanks in advance.
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Apr 15, 2008, 1:45 PM EDT
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Apr 15, 2008, 2:12 PM EDT
Try this out. The following code will prevent you to open duplicate form.
foreach (Form frmchild in this.MdiChildren)
{
if (frmcompany is chldfrm)
{
frmchild.Show();
frmchild.Focus();
return;
}
}
chldfrm frmchild1 = new chldfrm();
this.AddOwnedForm(frmchild1);
frmchild1.MdiParent = this;
frmchild1.Show();
Mark Christian Baliling2 pointsPosted Apr 16, 2008, 5:00 AM EDT
James,
Your code works, however it took me a couple of minutes how to work it out.
Thanks!