Creating Dialog Boxes
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
- Add a form to your project by right-clicking the project in Solution Explorer, pointing to Add, and then clicking Windows Form.
- Right-click the form in Solution Explorer and choose Rename. Rename the form "DialogBox.vb" or "DialogBox.cs" as appropriate.
- In the Properties window, change the FormBorderStyle property to FixedDialog.
- Customize the appearance of the form as needed.
- 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.
- 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).