Force application close on system shutdown
In your FormClosing event check the FormClosingEventArgs’ CloseReason property to see why the window is closing down. If it is CloseReason.WindowsShutDown then don’t show your dialog and do not cancel the closing of your form. private void MyForm_FormClosing(object sender, FormClosingEventArgs e) { // Verify that we’re not being closed because windows is shutting down. if … Read more