Answers for "message box icons c#"

C#
0

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;  
    }  
}
Posted by: Guest on April-24-2021

C# Answers by Framework

Browse Popular Code Answers by Language