On Windows mobile 6.1 prof.
I have a messagebox with a yes/no button on it. When I click ‘No’ option in the messagebox, my whole application shutsdown, how can I simply close the messagebox?
string message = "Application will perform a data download agree?";
string caption = "";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result == DialogResult.Yes)
{
navigateForward(WEB_PAGE_NAVIGATE);
}
else
{
this.Close();
}
You do not need to close the message box. It’s a DialogWindow and will close itself when you click any of the options:
The reason your whole application shuts down is because
thisrelates to the class you’re currently in. I’m guessing that class is your mainFormand when your main form is closed, the application shuts down.