MessageBox.Show("your message",
"window title",
MessageBoxButtons.OK,
MessageBoxIcon.Warning // for Warning
//MessageBoxIcon.Error // for Error
//MessageBoxIcon.Information // for Information
//MessageBoxIcon.Question // for Question
);
MessageBox.Show("Some text", "Some title",
MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Some text", "Some title",
MessageBoxButtons.OK, MessageBoxIcon.Error);
//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
;
try
{
test();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DialogResult result = MessageBox.Show("Do you want to save changes?", "Confirmation", MessageBoxButtons.YesNoCancel);
if(result == DialogResult.Yes)
{
//...
}
else if (result == DialogResult.No)
{
//...
}
else
{
//...
}