Code:private void btnReg_Click(object sender, System.EventArgs e) { bool FrmIsOpen = false; if(this.MdiParent != null && this.MdiParent.MdiChildren != null) { for (int i=0; i < this.MdiParent.MdiChildren.Length; i++) { if (this.MdiParent.MdiChildren[i].GetType() == typeof(FrmPassword)) { FrmIsOpen = true; break; } } } if (!FrmIsOpen) { FrmPassword r = new FrmPassword(); r.MdiParent = this; r.Show(); } /*FrmPassword r = new FrmPassword(); r.MdiParent= this; r.Show();*/ }
i have this code here that checks whether a frm is already opened or not, if its not opened, it opens one, and if its already opened it'll show the one thats already opened and not a new one...all seems to be fine....but i still get the same form opening twice...whats wrong?




Reply With Quote