I'm trying to use an OKCancel Messagebox in Visual C++ in an Exit button.
I can't figure out how to take the user clicking the OK button in a IF statement to quit the program using Close();
Here is what I have where it tells me what the user clicked, but how can I use this to actually test for the OK button and Close() ?
I've tried a string compare but I'm too much of a novice to pull it off
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
Windows::Forms::DialogResult buttonClicked;buttonClicked = MessageBox::Show("click a button","what",MessageBoxButtons::OKCancel);
MessageBox::Show(String::Concat( "you clicked the ", buttonClicked, " button")) ;