MessageBox and Ok Cancel question

G

Guest

Hi,

i've this code

private void Esc_close_application_Click(object sender,
System.EventArgs e)
{
MessageBox.Show("Are you sure?", "Exit",
MessageBoxButtons.OKCancel);

if (OKButton clicked)
{
Application.Exit();
}
if/else(CancelButton clicked)

{
return to the application
}

}

how i write the codes in the if?

Thanks
 
T

Tom Dacon

DialogResult dr = MessageBox.Show(blah blah blah);
if (dr == DialogResult.OK)
{
blah blah blah;
}

(more or less - this is from memory)

Tom Dacon
Dacon Software Consulting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top