messagebox custom icons in c# code example
Example: message box icons c#
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
const string message =
"Are you sure that you would like to close the form?";
const string caption = "Form Closing";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation);
// If the no button was pressed ...
if (result == DialogResult.No)
{
// cancel the closure of the form.
e.Cancel = true;
}
}