We will have to use the MessageBox static class and the following process for this:

The code will be written in the event handler of the buttons obviously. The following is the template code to create a message prompt when a user clicks a definite button.


MessageBox::Show("Message", "Message Title", MessageBoxButtons::YesNo, MessageBoxIcon::Warning);


We will have to write the following code if we want the dialog box to prompt again and again if the user clicks "no" and close the dialog box if the user clicks "yes".


if (MessageBox::Show("Is this helpful?", "SimpleQuestion", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::No) {

button1->PerformClick();

}


For the Exit button , we can use the application::Exit function as:

Application::Exit();