Display Question messagebox and check its result : MessageBox « GUI Windows Form « C# / C Sharp






Display Question messagebox and check its result

Display Question messagebox and check its result

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Test{
    [STAThread]
    static void Main() 
    {
            DialogResult reply = MessageBox.Show("Question?",
            "Yes or No Demo",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
      
            if (reply == DialogResult.Yes){
               MessageBox.Show("Yes");
            } else {
               MessageBox.Show("No");
            }
    }
}
           
       








Related examples in the same category

1.Yes No Cancel
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