imgThere are several dialog boxes that can also be displayed: OpenFileDialog img, SaveFileDialog img, FontDialog img, ColorDialog img, PrintDialog img, and PrintPreviewDialog img. The dialogs, such as the color dialog shown on the right are the same dialog windows that you see in other Windows applications.
  1. Start a new Windows application and name it Dialogs.
  2. Scroll down to find the ColorDialog img control and double click. It does not appear on the form, but in the panel below the form. Add FontDialog img and OpenFileDialog img.
  3. Add buttons img named BtnColor, BtnFont, and BtnPicture.
  4. Add a label img called LblMessage. Set AutoSize to True.
  5. Add a picture box img named Pic1. Set SizeMode to AutoSize.
  6. Add the code for BtnColor and BtnFont as shown below.
  7. Private Sub BtnColor_Click(ByVal sender As System.Object, ByVal e As  _
     System.EventArgs) Handles BtnColor.Click
       ColorDialog1.ShowDialog()
       Me.BackColor = ColorDialog1.Color
    End Sub 'BtnColor_Click
    
    Private Sub BtnFont_Click(ByVal sender As System.Object, ByVal e As  _
     System.EventArgs) Handles BtnFont.Click
      Me.FontDialog1.ShowDialog()
      Me.LblMessage.Font = Me.FontDialog1.Font
    End Sub 'BtnFont_Click

    INDEX, Text Boxes, Input Boxes, Message Boxes, More Message Boxes, Dialog Boxes, Open File Dialog
    Next lesson: Loops in Visual Basic

    Copyright © Zebra0.com
    All rights reserved worldwide.

 
 

Dialog Boxes