Show method with button and icon settings : MessageBox « GUI Windows Forms « C# / CSharp Tutorial






using System;
using System.Windows.Forms;

public class MainClass {

    public static void Main() {
        DialogResult dr = MessageBox.Show("Do you want to create a new file?",
                                          "WonderWord",
                                          MessageBoxButtons.YesNoCancel,
                                          MessageBoxIcon.Question);
        if (dr == DialogResult.Yes) {
            // "Yes" processing
        } else if (dr == DialogResult.No) {
            // "No" processing
        } else {
            // "Cancel" processing
        }
    }
}








23.44.MessageBox
23.44.1.Simplest MessageBox
23.44.2.Get result from a MessageBox
23.44.3.Display MessageBox in Button event
23.44.4.Call Show method to display a MessageBox
23.44.5.Show method with message and window title
23.44.6.Show method with button and icon settings