private void FormEhrAmendmentEdit_Closing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (EhrAmendmentCur.IsNew) { EhrAmendments.Delete(EhrAmendmentCur.EhrAmendmentNum); ImageStore.CleanAmdAttach(EhrAmendmentCur.FileName); } }
private void butDelete_Click(object sender, EventArgs e) { if (EhrAmendmentCur.IsNew) { //no need to ask them } else { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete Amendment?")) { return; } } //in both cases, delete: ImageStore.CleanAmdAttach(EhrAmendmentCur.FileName); EhrAmendments.Delete(EhrAmendmentCur.EhrAmendmentNum); DialogResult = DialogResult.OK; //Causes grid to refresh in case this amendment is not new. }