March 19, 2016

Message Box in C#

We can call MessageBox.Show with just one argument. This is a string argument. An OK button is provided to dismiss the dialog.

MessageBox.Show("Welcome to askSudhir.");


Now let's add a second argument to our Show method call. The second argument is also a string. Sorry about the silly dialog text.

  MessageBox.Show("Welcome to askSudhir","Hi this is the header");


I like icons. Here we use an exclamation on our dialog. We specify MessageBoxIcon.Exclamation in the fourth method call. Again sorry for the message text.


No comments:

Post a Comment