private void buttonDelete_Click(object sender, EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } try{ PatFieldDefs.Delete(FieldDef); DialogResult = DialogResult.OK; } catch (ApplicationException ex) { MessageBox.Show(ex.Message); } }
private void buttonDelete_Click(object sender, EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } try{ PatFieldDefs.Delete(FieldDef); //Throws if in use. FieldDefLinks.DeleteForFieldDefNum(FieldDef.PatFieldDefNum, FieldDefTypes.Patient); //Delete any FieldDefLinks to this PatFieldDef FieldDef = null; DialogResult = DialogResult.OK; } catch (ApplicationException ex) { MessageBox.Show(ex.Message); } }