c# messagebox.show code example
Example 1: c# MessageBox
MessageBox.Show("text", "title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Example 2: messagebox.show c# error
MessageBox.Show("Some text", "Some title",
MessageBoxButtons.OK, MessageBoxIcon.Error);
Example 3: c# messagebox result
//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)
Example 5: action upton execution of ok button in msg box win forms
if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
// user clicked yes
}
else
{
// user clicked no
}