How to do a confirm exit and trap any attempt to close the form private: System::Void mnuFile_Exit_Click(System::Object^ sender, System::EventArgs^ e) { DoExit(); //cancel from a menu? } private: System::Void btnQuit_Click(System::Object^ sender, System::EventArgs^ e) { DoExit(); //this will trigger the Form_Closing event } private: void DoExit() { this->Close(); } private: System::Void frmMain_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) { //pressing the X, or using the control box, or using ALT-F4 will raise this event automatically //---if they say NO to quitting, then cancel the form_closing event. Otherwise, just keep running if (MessageBox::Show("Are you sure?", "System Message", MessageBoxButtons::YesNo) == System::Windows::Forms::DialogResult::No) e->Cancel = true; //CANCELS THE FORM_CLOSING EVENT and keeps the app running }