Yes No Cancel : MessageBox « GUI Windows Form « C# / C Sharp






Yes No Cancel

 
using System;
using System.Windows.Forms;

public class MainClass {

    public static void Main() {
        switch (MessageBox.Show("Do you want to create a new file?",
                            "WonderWord",
                            MessageBoxButtons.YesNoCancel,
                            MessageBoxIcon.Question)) {
            case DialogResult.Yes:
                // "Yes" processing
                break;

            case DialogResult.No:
                // "No" processing
                break;

            case DialogResult.Cancel:
                // "Cancel" processing
                break;
        }
    }
}

 








Related examples in the same category

1.Display Question messagebox and check its resultDisplay Question messagebox and check its result
2.MessageBox OptionsMessageBox Options
3.MessageBox with OK button and information iconMessageBox with OK button and information icon
4.Message box builderMessage box builder
5.Information message boxInformation message box
6.A message boxA message box