Working with Message Boxes in Visual Studio 2012

Message boxes convey information and warnings to the end user. For example, open a blank Microsoft Word document, write some text and try to exit. Word will display a message box as shown below.

In Visual Studio 2012, you can display message boxes in 21 formats. However, many developers make use of few common message boxes for their applications.

  1. MessageBox.Show("Message Box Demo");  

  1. MessageBox.Show("Message Box Demo""Sample App");  

  1. MessageBox.Show("Message Box Demo","Sample App",MessageBoxButtons.OKCancel);  

You can display the above message box in 6 different formats

In the same way, you can display message boxes with three buttons with an icon as shown below

  1. MessageBox.Show("message box demo","Sample App",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Asterisk);  

Visual Studio provides an ability to include 7 variants of MessageBoxIcon Formats as shown below


Message boxes are extensively used during the Windows based software development process. With the help of Intellisense, developers will be able to integrate message box functionality into their applications very easily. Users will be able to interact with the message boxes while working with the relevant software product. I don't think any software can be entirely developed without message boxes.