private void addToolStripMenuItem_Click(object sender, EventArgs e) { bool show = true; AddAtmForm addAtmForm = new AddAtmForm(); foreach (Form item in this.MdiChildren) { if (item is AddAtmForm) { show = false; item.Focus(); } } if (show) { addAtmForm.MdiParent = this; addAtmForm.Show(); } }
private void lbAtm_DoubleClick(object sender, EventArgs e) { Atm editAtm = (Atm)lbAtm.SelectedItem; bool show = true; AddAtmForm editAtmForm = new AddAtmForm("edit", editAtm); foreach (Form item in this.MdiChildren) { if (item is AddAtmForm) { show = false; item.Focus(); } } if (show) { editAtmForm.MdiParent = mdiParent; editAtmForm.Show(); } }