Creating Custom Dialog Boxes

Most of the time, the MessageBox.Show() method should be a sufficient means to display messages to a user. At times, however, the MessageBox.Show() method is too limited for a given purpose. For example, suppose that you wanted to display a lot of text to a user (such as a log file of some sort) and therefore wanted a message box that is sizable by the user.

Custom dialog boxes are nothing more than standard modal forms with one notable exception: One or more buttons are designated to return a dialog result, just as the buttons on a message box shown with the MessageBox.Show() method return a dialog result.

You're now going to create a custom dialog box. Create a new Windows Application titled Custom Dialog Example ...

Get Sams Teach Yourself Microsoft® Visual C#™ .NET in 24 Hours 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.