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
    5.8K+ Learners
    4.45  (301)
    AI and Big Data in IOT
    1 hrs
    Intermediate
    10.2K+ Learners
    4.47  (1152)
    Selenium Basics
    1 hrs
    Beginner
    25.4K+ Learners
    4.43  (1917)
    Selenium with Python
    1 hrs
    Beginner
    13.2K+ Learners
    4.44  (819)
    Selenium Projects with Python
    2 hrs
    Intermediate
    8.8K+ Learners
    4.5  (242)
    Java Projects
    1 hrs
    Beginner
    25.2K+ Learners
    4.19  (243)
    JDBC in Java
    1 hrs
    Beginner
    9.3K+ Learners
    4.42  (797)
    Flask Python
    1 hrs
    Beginner
    8.2K+ Learners
    4.38  (456)
    Linked List in Python
    3 hrs
    Beginner
    2.9K+ Learners
    4.55  (62)
    Leap year program in Python
    1 hrs
    Beginner
    2.2K+ Learners
    4.45  (71)