home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form frmDialogDemo BackColor = &H00C0C0C0& Caption = "COMMDLG.DLL Demo" ClientHeight = 2265 ClientLeft = 1905 ClientTop = 2730 ClientWidth = 4245 Height = 2790 Left = 1845 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2265 ScaleWidth = 4245 Top = 2265 Width = 4365 Begin CommandButton cmdDialog Caption = "&Save" Height = 435 Index = 3 Left = 3180 TabIndex = 4 Top = 720 Width = 915 End Begin CommandButton cmdDialog Caption = "&Open" Height = 435 Index = 2 Left = 2160 TabIndex = 3 Top = 720 Width = 915 End Begin CommandButton cmdDialog Caption = "&Color" Height = 435 Index = 1 Left = 1140 TabIndex = 2 Top = 720 Width = 915 End Begin CommandButton cmdDialog Caption = "&Font" Height = 435 Index = 0 Left = 120 TabIndex = 1 Top = 720 Width = 915 End Begin TextBox txtDialog Height = 435 Left = 120 TabIndex = 0 Top = 120 Width = 3975 End Begin Label lbl Alignment = 2 'Center BackStyle = 0 'Transparent Caption = "This example is bits and pieces put together from the works of others downloaded from CIS and modified to actually work. Anything to get rid of another needless VBX !!!" Height = 855 Left = 180 TabIndex = 5 Top = 1320 Width = 3915 End Option Explicit Sub cmdDialog_Click (Index As Integer) Dim DirPath$, FileSpec$, Filters$, OpenFile% Select Case Index Case 0 ' Font If DialogFont(txtDialog) = True Then txtDialog.Text = txtDialog.FontName Case 1 ' Color txtDialog.BackColor = DialogColor(txtDialog, (txtDialog.BackColor)) Case 2 ' Open file DirPath$ = "" ' "C:\WINDOWS\VB" FileSpec$ = "" ' limits to only matching files (wildcards allowed *.*) Filters$ = "Graphic Files|*.bmp; *.ico|Text Files|*.txt" OpenFile% = True txtDialog.Text = DialogFile(DirPath$, FileSpec$, Filters$, OpenFile%) Case 3 ' Save file DirPath$ = "" ' "C:\WINDOWS\VB\PROJECTS" FileSpec$ = "MYFILE.RPT" ' default file name Filters$ = "Report Files|*.rpt" OpenFile% = False txtDialog.Text = DialogFile(DirPath$, FileSpec$, Filters$, OpenFile%) End Select End Sub