Nishant Sivakumar has given a very good example.
Here is another one with multiple cases.
DialogResult DialogResult = DialogResult.None ;
DialogResult = MessageBox.Show("Ask", "Title",
MessageBoxButtons.YesNoCancel);
switch(DialogResult)
{
case DialogResult.Yes:
break;
case DialogResult.No :
break;
case DialogResult.Cancel :
break;
default:
break;
}