I think I read how to do this but searching 'FormClosing' in this forum didn't find anything much.
I simply need to cancel the closing of a form (after user dialog confirmation). Is this the correct approach?
private void OnFormClosing(object sender, FormClosingEventArgs e){ var dlg = new DlgConfirmUnsavedForm(); var result = dlg.ShowDialog(); if (result == DialogResult.Cancel) { e.Cancel = true; OnClosing(e); return; //?? } else if (result == DialogResult.Yes) { SaveForm(); } ...}
By the way, post editing is terrible!
