VB.NET Developer's Guide

Dialog Boxes

Dialog boxes display information to the user and collect information from the user. They are useful because they present visual cues that are familiar to the Windows user. Technically, a dialog box is merely a form with a border style of fixed dialog. As we have seen, this adjusts the appearance of the dialog box in several ways:

  • A dialog box is not resizable.
  • A dialog box can include a title bar, a control-menu box, and Maximize and Minimize buttons (but they usually do not include the latter three).
  • A dialog box has a recessed border relative to the body of the form.

You can use the dialog boxes that are predefined in the .NET Framework or create your own.

Displaying Message Boxes

A message box displays application-related information to the user and collects an acknowledgement or a choice from the user. For example, when you delete a file in Windows Explorer, a message box confirms whether you want to delete the file and collects your choice.

You can display a message box using the Show method of the MessageBox class. At a minimum, the Show method takes a message parameter. The following code displays a message box informing the user of the completion of a backup:

Messagebox.Show("The backup of 'My C Drive (C:)' is complete.")

Often message boxes collect a choice from the user. The Show method returns a value that you can use to determine the user s choice. The following snippet displays...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: LED Message Displays
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.