How to show alert MessageBox in Windows forms applications in C#.net || How to show Confirm MessageBox with Yes No buttons in windows Applications in C#.net



To show alert MessageBox in Windows forms:

            MessageBox.Show("Welcome to DotNet");



To show Confirm MessageBox with Yes No buttons in Windows forms:

             DialogResult result;

            result = MessageBox.Show("Are You sure want to Delete?", "Conformation"MessageBoxButtons.YesNo);



            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                MessageBox.Show("Records Deleted Successfully");

            }
            else
            {
                MessageBox.Show("No action");

            }
                     
                   
From second message box if you click Yes :



If you click No :




1 comment:

  1. You misspelled "confirmation" there as "conformation."

    ReplyDelete