Zebra0.com

csharp dialogs

In addition to OK, and YesNO, the following buttons can be shown:

Think about when would you use these buttons, or where you might have seen them.

You can also display an icon along with these buttons by adding one of the values below to one of the values above. The message box below was displayed with the statement:

 result = MessageBox.Show(this, "Message", "Caption", MessageBoxButtons.YesNo,
 MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
 MessageBoxOptions.RightAlign);
 

Notice that the message box above has Yes selected as the default. If the user presses Enter, it is the same as clicking Yes. You can change the default selection by selecting a different option after typing the dot. You can also change select any of the icons after typing MessageBoxIcon then type the dot to show the options:

Note: Only one icon and one default button can be included. Experiment with as many different combinations as you can.

End of lesson, Next lesson: forms in C#