private void butDelete_Click(object sender, System.EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; } else { string inuseby = ReqStudents.InUseBy(ReqCur.ReqNeededNum); if (inuseby != "") { MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(Lan.g(this, "Requirement is already in use by student(s) with grade point(s) attached." + "\r\n" + Lan.g(this, "Delete anyway? Student grades will not be affected.")) + "\r\n" + inuseby); msgBox.ShowDialog(); if (msgBox.DialogResult != DialogResult.OK) { return; } } if (!MsgBox.Show(this, true, "Delete this Requirement?")) { return; } } ReqCur = null; DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, System.EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; } else { string inuseby = ReqStudents.InUseBy(ReqCur.ReqNeededNum); if (inuseby != "") { if (MessageBox.Show(Lan.g(this, "Requirement is already in use by student(s) with grade point(s) attached:") + "\r\n" + inuseby + Lan.g(this, "Delete anyway? Student grades will not be affected."), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } } if (!MsgBox.Show(this, true, "Delete this Requirement?")) { return; } try{ ReqNeededs.Delete(ReqCur.ReqNeededNum); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } DialogResult = DialogResult.OK; }