Displays a message box. Msdn MessageBox.Show Method
1,
When you want to display a button like Figure 3 and you want to get a different response when you click a different button, you can add one after MessageBoxButtons. (should be in English point, here in order to eye-catching, in Chinese instead) you can see a few buttons below the cue box to choose the different options, the following figure:
if (MessageBox.Show ("Show Message", "title", messageboxbuttons.yesnocancel) = = Dialogresult.yes)
{
Click Yes to do the appropriate processing
}
The return value for MessageBox.Show () is yes, no, OK, or cancel, and you need to set the selection button that it can display in the show () method. That is, clicking a different button returns the same value.
EG:
When MessageBox () is used in C #, the pop-up of the dialog box is usually implemented using the MessageBox Show method, the namespace System.Windows.Forms
application Example:
DialogResult r1 = MessageBox.Show ("Display cue message", "title", Messageboxbuttons.yesnocancel, messageboxicon.question);
if (R1. ToString () = = "Yes")
{MessageBox.Show ("Yes"); }
if (R1. ToString (). Equals ("No"))
{MessageBox.Show ("No");}
if (R1. ToString (). Equals ("Cancel"))
{MessageBox.Show ("Cancel"); }
Display effect:
Click Yes to eject Yes, click No, Pop No, click Cancel to eject Cancel.