- VB.Net - Event Handling
- VB.Net - Advanced Forms
- VB.Net - Dialog Boxes
- VB.Net - Basic Controls
- VB.Net - File Handling
- VB.Net - Exception Handling
- VB.Net - Classes & Objects
- VB.Net - Subs
- VB.Net - Functions
- VB.Net - Collections
- VB.Net - Arrays
- VB.Net - Date & Time
- VB.Net - Strings
- VB.Net - Loops
- VB.Net - Decision Making
- VB.Net - Operators
- VB.Net - Directives
- VB.Net - Statements
- VB.Net - Modifiers
- VB.Net - Constants
- VB.Net - Variables
- VB.Net - Data Types
- VB.Net - Basic Syntax
- VB.Net - Program Structure
- VB.Net - Environment Setup
- VB.Net - Overview
- VB.Net - Home
VB.Net Advanced Tutorial
- VB.Net - Web Programming
- VB.Net - XML Processing
- VB.Net - Send Email
- VB.Net - Excel Sheet
- VB.Net - Database Access
- VB.Net - Regular Expressions
VB.Net Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
VB.Net - Dialog Boxes
There are many built-in dialog boxes to be used in Windows forms for various tasks pke opening and saving files, printing a page, providing choices for colors, fonts, page setup, etc., to the user of an apppcation. These built-in dialog boxes reduce the developer s time and workload.
All of these dialog box control classes inherit from the CommonDialog class and override the RunDialog() function of the base class to create the specific dialog box.
The RunDialog() function is automatically invoked when a user of a dialog box calls its ShowDialog() function.
The ShowDialog method is used to display all the dialog box controls at run-time. It returns a value of the type of DialogResult enumeration. The values of DialogResult enumeration are −
Abort − returns DialogResult.Abort value, when user cpcks an Abort button.
Cancel − returns DialogResult.Cancel, when user cpcks a Cancel button.
Ignore − returns DialogResult.Ignore, when user cpcks an Ignore button.
No − returns DialogResult.No, when user cpcks a No button.
None − returns nothing and the dialog box continues running.
OK − returns DialogResult.OK, when user cpcks an OK button
Retry − returns DialogResult.Retry , when user cpcks an Retry button
Yes − returns DialogResult.Yes, when user cpcks an Yes button
The following diagram shows the common dialog class inheritance −
All these above-mentioned classes have corresponding controls that could be added from the Toolbox during design time. You can include relevant functionapty of these classes to your apppcation, either by instantiating the class programmatically or by using relevant controls.
When you double cpck any of the dialog controls in the toolbox or drag the control onto the form, it appears in the Component tray at the bottom of the Windows Forms Designer, they do not directly show up on the form.
The following table psts the commonly used dialog box controls. Cpck the following pnks to check their detail −
Sr.No. | Control & Description |
---|---|
1 |
It represents a common dialog box that displays available colors along with controls that enable the user to define custom colors. |
2 |
It prompts the user to choose a font from among those installed on the local computer and lets the user select the font, font size, and color. |
3 |
It prompts the user to open a file and allows the user to select a file to open. |
4 |
It prompts the user to select a location for saving a file and allows the user to specify the name of the file to save data. |
5 |
It lets the user to print documents by selecting a printer and choosing which sections of the document to print from a Windows Forms apppcation. |