The MessageBox.Show method returns a value indicating what button they
pressed. Here is an example from one of my projects:
if (MessageBox.Show("Delete category ?", "Verify Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
Or, you could assign the result to a variable such as:
DialogResult dr = MessageBox.Show("Blah blah blah", "Caption",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button3);
if (dr == DialogResult.Yes)
{
// do something
}
HTH,
Mark