VB.Net

VB.Net Dialog Boxes

VB.Net Dialog Boxes

Several built-in dialogue boxes may be used in Windows forms to do various activities such as opening and saving files, printing a page, providing colour, font, and page setting options to an application's user, and so on. These built-in dialogue windows save the developer time and effort.

First, let us update read execute commands and retrieve data, store and connect dialogue box control classes derive from the CommonDialog class and override the base class's RunDialog() function to construct the appropriate dialogue box.

On calling the ShowDialog() function by the user of the dialogue box, the RunDialog() function is automatically invoked.

At runtime, the ShowDialog method is used to display all of the dialogue box controls. It returns a value of the DialogResult enumeration type. The values of the DialogResult enumeration are as follows:

  • Abort − returns DialogResult.Abort value, on clicking on Abort button.
  • Cancel − returns DialogResult.Cancel, on clicking on a Cancel button.
  • Ignore − returns DialogResult.Ignore on clicking on the 'Ignore' button.
  • No − returns DialogResult.No, on clicking on a No button.
  • None − returns nothing, dialogue box continues running.
  • OK − returns DialogResult.OK, on clicking on the OK button
  • Retry − returns DialogResult.Retryby, on clicking on the Retry button
  • Yes − returns DialogResult.Yes, on clicking on the Yes button

Common dialog class inheritance is as shown below−

VB.Net Dialog Boxes

All these classes mentioned above have corresponding controls that could be added from the Toolbox during design time. You can include relevant functionality of these classes to your application, either by instantiating the class programmatically or by using appropriate controls.

When you double-click any of the dialogue 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; first, let us do not directly show up on the form.

The commonly used dialog box controls are ColorDialog, FontDialog, OpenFileDialog, SaveFileDialog, PrintDialog

Top course recommendations for you

    Python Stack
    2 hrs
    Beginner
    3.8K+ Learners
    4.52  (94)
    AI and Big Data in IOT
    1 hrs
    Intermediate
    7.8K+ Learners
    4.5  (495)
    Selenium Basics
    1 hrs
    Beginner
    20.9K+ Learners
    4.41  (1193)
    Selenium with Python
    1 hrs
    Beginner
    11K+ Learners
    4.39  (532)
    Selenium Projects with Python
    2 hrs
    Intermediate
    7.6K+ Learners
    4.54  (173)
    Java Projects
    1 hrs
    Beginner
    19.7K+ Learners
    4.17  (192)
    JDBC in Java
    1 hrs
    Beginner
    7.5K+ Learners
    4.45  (415)
    Flask Python
    1 hrs
    Beginner
    6.3K+ Learners
    4.3  (261)
    Linked List in Python
    3 hrs
    Beginner
    2.5K+ Learners
    4.61  (41)
    Leap year program in Python
    1 hrs
    Beginner
    1.9K+ Learners
    4.63  (48)