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
    6.2K+ Learners
    4.41  (400)
    AI and Big Data in IOT
    1 hrs
    Intermediate
    10.7K+ Learners
    4.48  (1308)
    Selenium Basics
    1 hrs
    Beginner
    25.9K+ Learners
    4.43  (2066)
    Selenium with Python
    1 hrs
    Beginner
    13.5K+ Learners
    4.45  (903)
    Selenium Projects with Python
    2 hrs
    Intermediate
    9K+ Learners
    4.52  (281)
    Java Projects
    1 hrs
    Beginner
    25.9K+ Learners
    4.19  (247)
    JDBC in Java
    1 hrs
    Beginner
    9.7K+ Learners
    4.42  (1008)
    Flask Python
    1 hrs
    Beginner
    8.7K+ Learners
    4.38  (634)
    Linked List in Python
    3 hrs
    Beginner
    3K+ Learners
    4.56  (70)
    Leap year program in Python
    1 hrs
    Beginner
    2.3K+ Learners
    4.53  (83)