Thursday, 15 November 2012

Message Box using C Sharp

Message Box in C Sharp :

                                         lets create a complete message box using C sharp in easy steps.

Step 1:

              Create a new Windows Forms Application project in C sharp.

Step 2:

           



Click on toolbox and then click on button and drag it to your form.



Step 3:

Now we have a button appeared on our form.
Double click on button to add some code to it.


Step 4:

           Now lest type some code for Message box.

MessageBox.Show("   Message   ");

This is  to show a message box.




MessageBox.Show("   Message   "," Title ");

This is to show a message box with a title

Step 5: 

Now lets proceed further and  have few Buttons.



MessageBox.Show("   Message   "," Title ",MessageboxButtons);

This is to show a message box with a title and few buttons you selected form intellisense.
Intellisense in some sort of helping dialog to avoid spelling mistakes and speed up coding effectively .



Step 6:


MessageBox.Show("Message","Title",MessageboxButtons,MessageBoxIcon);
This code will add icone to your message box. while coding you can sellect Icon from intellisense.


         
Finally message box code should have the following syntax. 

 MessageBox.Show("Message","Title",MessageBoxButtons.YesNo,MessageBoxIcon.Information);

No comments:

Post a Comment