home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / code / various / cmdial / cmdialog.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-27  |  3.1 KB  |  93 lines

  1. VERSION 2.00
  2. Begin Form frmDialogDemo 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "COMMDLG.DLL Demo"
  5.    ClientHeight    =   2265
  6.    ClientLeft      =   1905
  7.    ClientTop       =   2730
  8.    ClientWidth     =   4245
  9.    Height          =   2790
  10.    Left            =   1845
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2265
  15.    ScaleWidth      =   4245
  16.    Top             =   2265
  17.    Width           =   4365
  18.    Begin CommandButton cmdDialog 
  19.       Caption         =   "&Save"
  20.       Height          =   435
  21.       Index           =   3
  22.       Left            =   3180
  23.       TabIndex        =   4
  24.       Top             =   720
  25.       Width           =   915
  26.    End
  27.    Begin CommandButton cmdDialog 
  28.       Caption         =   "&Open"
  29.       Height          =   435
  30.       Index           =   2
  31.       Left            =   2160
  32.       TabIndex        =   3
  33.       Top             =   720
  34.       Width           =   915
  35.    End
  36.    Begin CommandButton cmdDialog 
  37.       Caption         =   "&Color"
  38.       Height          =   435
  39.       Index           =   1
  40.       Left            =   1140
  41.       TabIndex        =   2
  42.       Top             =   720
  43.       Width           =   915
  44.    End
  45.    Begin CommandButton cmdDialog 
  46.       Caption         =   "&Font"
  47.       Height          =   435
  48.       Index           =   0
  49.       Left            =   120
  50.       TabIndex        =   1
  51.       Top             =   720
  52.       Width           =   915
  53.    End
  54.    Begin TextBox txtDialog 
  55.       Height          =   435
  56.       Left            =   120
  57.       TabIndex        =   0
  58.       Top             =   120
  59.       Width           =   3975
  60.    End
  61.    Begin Label lbl 
  62.       Alignment       =   2  'Center
  63.       BackStyle       =   0  'Transparent
  64.       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 !!!"
  65.       Height          =   855
  66.       Left            =   180
  67.       TabIndex        =   5
  68.       Top             =   1320
  69.       Width           =   3915
  70.    End
  71. Option Explicit
  72. Sub cmdDialog_Click (Index As Integer)
  73.     Dim DirPath$, FileSpec$, Filters$, OpenFile%
  74.     Select Case Index
  75.     Case 0  ' Font
  76.         If DialogFont(txtDialog) = True Then txtDialog.Text = txtDialog.FontName
  77.     Case 1  ' Color
  78.         txtDialog.BackColor = DialogColor(txtDialog, (txtDialog.BackColor))
  79.     Case 2  ' Open file
  80.         DirPath$ = ""  ' "C:\WINDOWS\VB"
  81.         FileSpec$ = ""  ' limits to only matching files (wildcards allowed *.*)
  82.         Filters$ = "Graphic Files|*.bmp; *.ico|Text Files|*.txt"
  83.         OpenFile% = True
  84.         txtDialog.Text = DialogFile(DirPath$, FileSpec$, Filters$, OpenFile%)
  85.     Case 3  ' Save file
  86.         DirPath$ = ""  ' "C:\WINDOWS\VB\PROJECTS"
  87.         FileSpec$ = "MYFILE.RPT"  ' default file name
  88.         Filters$ = "Report Files|*.rpt"
  89.         OpenFile% = False
  90.         txtDialog.Text = DialogFile(DirPath$, FileSpec$, Filters$, OpenFile%)
  91.     End Select
  92. End Sub
  93.