Dialog Box in VB.NET

In this article you will learn how to Creating Dialog Box at design time in VB.NET
  • 20119

Dialog Boxes in Windows Forms

Dialog boxes are used to interact with the user and retrieve information. In simple terms, a dialog box is a form with its FormBorderStyle Enumeration property set to FixedDialog. You can construct your own custom dialog boxes using the Windows Forms Designer. Add controls such as Label, Textbox, and Button to customize dialog boxes to your specific needs. The .NET Framework also includes predefined dialog boxes (such as File Open, and message boxes), which you can adapt for your own applications.

Creating Dialog Box at design time

Here is the step by step method to create a dialog box :

  1. Add a form to your project by right-clicking the project in Solution Explorer, pointing to Add, and then clicking Windows Form

    image2.gif
     
  2. Right-click the form in Solution Explorer and choose Rename. Rename the form "DialogBox.vb".

    image3.gif
     
  3. In the Properties window, change the FormBorderStyle property to FixedDialog.

    image4.gif
     
  4. Customize the appearance of the form as needed.
     
  5. 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.

    image5.gif

    image6.gif
     
  6. Customize event methods in the Code Editor.

    Public Class DialogBox

        Private Sub DialogBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           
        End Sub

    End Class

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.