private void btnAdd_Click(object sender, EventArgs e) { foreach (Form form in System.Windows.Forms.Application.OpenForms) { if (form.Name == "frmStudentPass") { form.Close(); break; } } frmStudentPass studentPassForm = new frmStudentPass(); studentPassForm.MdiParent = this.MdiParent; studentPassForm.Show(); beenHere = false; }
private void btnEdit_Click(object sender, EventArgs e) { if (grdPassHolderDetails.Rows.Count <= 0 || grdPassHolderDetails.CurrentRow == null) { return; } foreach (Form form in System.Windows.Forms.Application.OpenForms) { if (form.Name == "frmStudentPass") { form.Close(); break; } } frmStudentPass studentPassForm = new frmStudentPass(int.Parse(grdPassHolderDetails.CurrentRow.Cells[0].Value.ToString())); studentPassForm.MdiParent = this.MdiParent; studentPassForm.Show(); beenHere = false; }