private void frmVCard_FormClosing(object sender, FormClosingEventArgs e) { PersistControlValue.StoreControlValue(txtOutputLocation); bool changed = false; foreach (tblCrediteur d in crediteuren) { if (d.Dirty) { changed = true; break; } } if (changed) { DialogResult dr = MessageBox.Show("Save changes?", "Save changes?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { cmdSave.PerformClick(); } else { dataAdaptor.CancelTransaction(true); } } // e.Cancel = false; }
protected override void OnClosing(CancelEventArgs e) { try { if (!e.Cancel && (this.DialogResult == DialogResult.Cancel)) { da.CancelTransaction(true); } } finally { } }
private void frmEenmaligeRekening_FormClosing(object sender, FormClosingEventArgs e) { DialogResult dr = MessageBox.Show("Aangemaakte rekeningen (" + localRekeningen.Count.ToString() + ") bewaren?", "Bewaren?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { dataAdaptor.UpdateRekeningen(rekeningen); dataAdaptor.CommitTransaction(true); } else { foreach (tblRekening rek in localRekeningen) { rekeningen.Remove(rek); } dataAdaptor.CancelTransaction(true); } }