Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Creating Dialog Boxes

Visual Studio .NET 2003

Dialog boxes are displayed modally to prevent users from performing tasks outside of the dialog box. For more information on modal and modeless dialog boxes, see Displaying Modal and Modeless Windows Forms.

To create a dialog box at design time

  1. Add a form to your project by right-clicking the project in Solution Explorer, pointing to Add, and then clicking Windows Form.
  2. Right-click the form in Solution Explorer and choose Rename. Rename the form "DialogBox.vb" or "DialogBox.cs" as appropriate.
  3. In the Properties window, change the FormBorderStyle property to FixedDialog.
  4. Customize the appearance of the form as needed.
  5. Set the ControlBox, MinimizeBox, and MaximizeBox properties to false.

    Dialog boxes do not usually include menu bars, window scroll bars, Minimize and Maximize buttons, status bars, or sizable borders.

  6. Customize event methods in the Code Editor. For more information, see Closing Dialog Boxes and Retaining User Input.

Additionally, the .NET Framework has a number of pre-formatted dialog boxes that you can implement for basic tasks within your application that involve user input (opening files, printing files, saving files). For more information, see Dialog Box Controls and Components (Windows Forms).

See Also

Dialog Boxes in Windows Forms | Creating Windows Forms | Event Handling in Windows Forms

Show:
© 2015 Microsoft