You should use the FormClosing event to show a dialog box.
string msg= "Do you want to close the application?"; string caption = "Confirm..."; if ( MessageBox.Show( msg, caption, MessageBoxButtons.YesNo ) == DialogResult.No ) e.Cancel = true;
Türkçe'si için tiklayin.