How to: Create Dialog Boxes at Design Time

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

Note Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Customizing Development Settings.

To create a dialog box at design time

  1. In Solution Explorer, right-click your project, point to Add, and then click Windows Form.

    A form is added to your project.

  2. In Solution Explorer, right-click the form and choose Rename.

  3. Rename the form DialogBox.vb or DialogBox.cs, depending on your programming language.

  4. In the Properties window, change the FormBorderStyle property to FixedDialog.

  5. Customize the appearance of the form if you need to.

  6. 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.

  7. Customize event methods in the Code Editor.

    For more information, see How to: Close Dialog Boxes and Retain 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, such as opening files, printing files, or saving files. For more information, see Dialog-Box Controls and Components (Windows Forms).

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft