Double confirmation on exit
Use this
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("Are you sure you want to close?", "Infomate", MessageBoxButtons.YesNo) == DialogResult.No)
{
e.Cancel = true;
}
}
Ah, did you check the CloseReason
for the FormClosing
event? I think you might get the same event for two different reasons (although I don't exactly expect that to happen normally); check your FormClosingEventArgs
to see what the parameters are.