Get result from a MessageBox : MessageBox : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » MessageBox »

 

Get result from a MessageBox









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

public  class  MainClass
{
        public  static  void  Main(){

                DialogResult  result  =  MessageBox.Show("Close?",  "Really  quit?",
                        MessageBoxButtons.YesNo,  MessageBoxIcon.Question);
                if  (result  ==  DialogResult.No)
                        Console.WriteLine("NO");
                else{
                        Console.WriteLine("Yes");
                }        
        }
}
    
   
  
   



Output

Yes


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» MessageBox