Example
In this section we will develop an applicatioin that
will show several dialog boxes. The source code needed
for this example is stored in the
"Source Code\Chapter16" directory.

Private Sub cmdColor_Click()
dlgCommon.CancelError = True
On Error GoTo dlgErrHandler
dlgCommon.Flags = cdlCCFullOpen
dlgCommon.ShowColor
lblTest.BackColor = dlgCommon.Color
Exit Sub
dlgErrHandler:
Exit Sub
End Sub
Private Sub cmdFont_Click()
dlgCommon.CancelError = True
On Error GoTo dlgErrHandler
dlgCommon.Flags = cdlCFBoth + cdlCFEffects
dlgCommon.ShowFont
lblTest.Font.Name = dlgCommon.FontName
lblTest.Font.Size = dlgCommon.FontSize
lblTest.Font.Bold = dlgCommon.FontBold
lblTest.Font.Italic = dlgCommon.FontItalic
lblTest.Font.Underline = dlgCommon.FontUnderline
lblTest.Font.Strikethrough = dlgCommon.FontStrikethru
lblTest.ForeColor = dlgCommon.Color
dlgErrHandler:
Exit Sub
End Sub
Private Sub cmdOpen_Click()
dlgCommon.Filter = "Word Docs
(*.doc)|*.doc|Excel Docs (*.xls)|*.xls"
dlgCommon.ShowOpen
End Sub
Private Sub cmdPrint_Click()
dlgCommon.ShowPrinter
End Sub
Private Sub cmdSave_Click()
dlgCommon.ShowSave
End Sub
 |
|
Today's lesson explained how
you can set up common dialog to perform standard
tasks. We used a special control called the
Common Dialog Box control, which produces six
different common dialog boxes.
|
|