how to show message box in c# code example
Example 1: c# MessageBox
MessageBox.Show("text", "title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Example 2: winforms messagebox with button
string message = "Do you want to close this window?";
string title = "Close Window";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, title, buttons);
if (result == DialogResult.Yes) {
this.Close();
} else {
}
Example 3: c# messagebox result
DialogResult result = MessageBox.Show("Do you like cats?", "Yes or No?", messageBoxButtons.YesNoCancel);
if (result == DialogResult.Yes)
;
else if (result == DialogResult.No)
;
else
;
Example 4: how to do a messagebox in c#
MessageBox.Show("Content", "Title", MessageBoxIcon.Error)