8.5. Message boxes

To display a predefined dialog box, we use the static MessageBox class. This class has only one method – the Show method. It is used to display a message box and its properties are used to determine the title, message, buttons, and icons shown in it. Table 8.3 shows different overloaded versions of the Show method and explains when to use each of them.

Table 8.3. What the various parameters of Show are used for
Parameters Used to
String Display a message box with the specified text.
String, String Display a message box with the specified text and caption.
String, String, MessageBoxButtons Display a message box with the specified text, caption, and buttons
String, String, MessageBoxButtons, MessageBoxIcon Display a message ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.