home *** CD-ROM | disk | FTP | other *** search
/ cd-rom express 12 / CDRE12.ISO / Utilities / Kyn / VB5Code.ZIP / frmMain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-07  |  40.3 KB  |  1,196 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  4. Begin VB.Form frmMain 
  5.    Caption         =   "Main Screen"
  6.    ClientHeight    =   5715
  7.    ClientLeft      =   60
  8.    ClientTop       =   630
  9.    ClientWidth     =   6450
  10.    HelpContextID   =   20
  11.    Icon            =   "frmMain.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5715
  14.    ScaleWidth      =   6450
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin ComctlLib.Toolbar tlbMain 
  17.       Align           =   1  'Align Top
  18.       Height          =   660
  19.       Left            =   0
  20.       TabIndex        =   0
  21.       Top             =   0
  22.       Width           =   6450
  23.       _ExtentX        =   11377
  24.       _ExtentY        =   1164
  25.       ButtonWidth     =   1032
  26.       ButtonHeight    =   1005
  27.       Appearance      =   1
  28.       ImageList       =   "imgMain"
  29.       _Version        =   327682
  30.       BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
  31.          NumButtons      =   12
  32.          BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  33.             Key             =   "new"
  34.             Object.Tag             =   ""
  35.             ImageIndex      =   1
  36.          EndProperty
  37.          BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  38.             Key             =   ""
  39.             Object.Tag             =   ""
  40.             Style           =   3
  41.             MixedState      =   -1  'True
  42.          EndProperty
  43.          BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  44.             Key             =   "save"
  45.             Object.Tag             =   ""
  46.             ImageIndex      =   3
  47.          EndProperty
  48.          BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  49.             Key             =   "print"
  50.             Object.Tag             =   ""
  51.             ImageIndex      =   4
  52.          EndProperty
  53.          BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  54.             Key             =   ""
  55.             Object.Tag             =   ""
  56.             Style           =   3
  57.             MixedState      =   -1  'True
  58.          EndProperty
  59.          BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  60.             Key             =   "search"
  61.             Object.Tag             =   ""
  62.             ImageIndex      =   6
  63.          EndProperty
  64.          BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  65.             Key             =   "delete"
  66.             Object.Tag             =   ""
  67.             ImageIndex      =   7
  68.          EndProperty
  69.          BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  70.             Key             =   "clear"
  71.             Object.Tag             =   ""
  72.             ImageIndex      =   8
  73.          EndProperty
  74.          BeginProperty Button9 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  75.             Key             =   ""
  76.             Object.Tag             =   ""
  77.             Style           =   3
  78.          EndProperty
  79.          BeginProperty Button10 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  80.             Key             =   "help"
  81.             Object.Tag             =   ""
  82.             ImageIndex      =   10
  83.          EndProperty
  84.          BeginProperty Button11 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  85.             Key             =   ""
  86.             Object.Tag             =   ""
  87.             Style           =   3
  88.          EndProperty
  89.          BeginProperty Button12 {0713F354-850A-101B-AFC0-4210102A8DA7} 
  90.             Key             =   "exit"
  91.             Object.Tag             =   ""
  92.             ImageIndex      =   12
  93.          EndProperty
  94.       EndProperty
  95.    End
  96.    Begin MSComDlg.CommonDialog dlgMain 
  97.       Left            =   5280
  98.       Top             =   3600
  99.       _ExtentX        =   847
  100.       _ExtentY        =   847
  101.       _Version        =   327680
  102.    End
  103.    Begin VB.Timer tmrMain 
  104.       Interval        =   100
  105.       Left            =   5880
  106.       Top             =   1680
  107.    End
  108.    Begin VB.CheckBox chkMain 
  109.       Caption         =   "X-Mas"
  110.       Height          =   255
  111.       Left            =   3960
  112.       TabIndex        =   7
  113.       Top             =   4920
  114.       Visible         =   0   'False
  115.       Width           =   855
  116.    End
  117.    Begin VB.Frame fraMisc 
  118.       Caption         =   "Misc"
  119.       ForeColor       =   &H00800080&
  120.       Height          =   1575
  121.       Left            =   240
  122.       TabIndex        =   4
  123.       Top             =   3600
  124.       Visible         =   0   'False
  125.       Width           =   3495
  126.       Begin VB.TextBox txtEmail 
  127.          Height          =   285
  128.          Left            =   600
  129.          MaxLength       =   30
  130.          TabIndex        =   36
  131.          Top             =   960
  132.          Visible         =   0   'False
  133.          Width           =   2175
  134.       End
  135.       Begin VB.TextBox txtWed 
  136.          Height          =   285
  137.          Left            =   600
  138.          MaxLength       =   8
  139.          TabIndex        =   35
  140.          Top             =   600
  141.          Visible         =   0   'False
  142.          Width           =   855
  143.       End
  144.       Begin VB.TextBox txtBirth 
  145.          Height          =   285
  146.          Left            =   600
  147.          MaxLength       =   8
  148.          TabIndex        =   34
  149.          Top             =   240
  150.          Visible         =   0   'False
  151.          Width           =   855
  152.       End
  153.       Begin VB.Label lblEmail 
  154.          AutoSize        =   -1  'True
  155.          Caption         =   "Email:"
  156.          Height          =   195
  157.          Left            =   60
  158.          TabIndex        =   22
  159.          Top             =   960
  160.          Visible         =   0   'False
  161.          Width           =   420
  162.       End
  163.       Begin VB.Label lblWed 
  164.          AutoSize        =   -1  'True
  165.          Caption         =   "Wed:"
  166.          Height          =   195
  167.          Left            =   90
  168.          TabIndex        =   21
  169.          Top             =   600
  170.          Visible         =   0   'False
  171.          Width           =   390
  172.       End
  173.       Begin VB.Label lblBirth 
  174.          AutoSize        =   -1  'True
  175.          Caption         =   "Birth:"
  176.          Height          =   195
  177.          Left            =   120
  178.          TabIndex        =   20
  179.          Top             =   240
  180.          Visible         =   0   'False
  181.          Width           =   360
  182.       End
  183.    End
  184.    Begin VB.Frame fraStatus 
  185.       Caption         =   "Status"
  186.       ForeColor       =   &H00008000&
  187.       Height          =   1095
  188.       Left            =   3840
  189.       TabIndex        =   5
  190.       Top             =   3600
  191.       Visible         =   0   'False
  192.       Width           =   1215
  193.       Begin VB.OptionButton optFamily 
  194.          Caption         =   "Family"
  195.          Height          =   255
  196.          Left            =   120
  197.          TabIndex        =   19
  198.          Top             =   720
  199.          Visible         =   0   'False
  200.          Width           =   855
  201.       End
  202.       Begin VB.OptionButton optFriend 
  203.          Caption         =   "Friend"
  204.          Height          =   255
  205.          Left            =   120
  206.          TabIndex        =   18
  207.          Top             =   360
  208.          Visible         =   0   'False
  209.          Width           =   975
  210.       End
  211.    End
  212.    Begin VB.Frame fraPhone 
  213.       Caption         =   "Phone"
  214.       ForeColor       =   &H00FF0000&
  215.       Height          =   2295
  216.       Left            =   3600
  217.       TabIndex        =   3
  218.       Top             =   960
  219.       Visible         =   0   'False
  220.       Width           =   2055
  221.       Begin VB.TextBox txtFax 
  222.          Height          =   285
  223.          Left            =   600
  224.          MaxLength       =   12
  225.          TabIndex        =   33
  226.          Top             =   1800
  227.          Visible         =   0   'False
  228.          Width           =   1215
  229.       End
  230.       Begin VB.TextBox txtCell 
  231.          Height          =   285
  232.          Left            =   600
  233.          MaxLength       =   12
  234.          TabIndex        =   32
  235.          Top             =   1440
  236.          Visible         =   0   'False
  237.          Width           =   1215
  238.       End
  239.       Begin VB.TextBox txtExt 
  240.          Height          =   285
  241.          Left            =   600
  242.          MaxLength       =   5
  243.          TabIndex        =   31
  244.          Top             =   1080
  245.          Visible         =   0   'False
  246.          Width           =   615
  247.       End
  248.       Begin VB.TextBox txtWork 
  249.          Height          =   285
  250.          Left            =   600
  251.          MaxLength       =   12
  252.          TabIndex        =   30
  253.          Top             =   720
  254.          Visible         =   0   'False
  255.          Width           =   1215
  256.       End
  257.       Begin VB.TextBox txtHome 
  258.          Height          =   285
  259.          Left            =   600
  260.          MaxLength       =   12
  261.          TabIndex        =   29
  262.          Top             =   360
  263.          Visible         =   0   'False
  264.          Width           =   1215
  265.       End
  266.       Begin VB.Label lblFax 
  267.          AutoSize        =   -1  'True
  268.          Caption         =   "Fax:"
  269.          Height          =   195
  270.          Left            =   240
  271.          TabIndex        =   17
  272.          Top             =   1800
  273.          Visible         =   0   'False
  274.          Width           =   300
  275.       End
  276.       Begin VB.Label lblCell 
  277.          AutoSize        =   -1  'True
  278.          Caption         =   "Cell:"
  279.          Height          =   195
  280.          Left            =   240
  281.          TabIndex        =   16
  282.          Top             =   1440
  283.          Visible         =   0   'False
  284.          Width           =   300
  285.       End
  286.       Begin VB.Label lblExt 
  287.          AutoSize        =   -1  'True
  288.          Caption         =   "Ext:"
  289.          Height          =   195
  290.          Left            =   270
  291.          TabIndex        =   15
  292.          Top             =   1080
  293.          Visible         =   0   'False
  294.          Width           =   270
  295.       End
  296.       Begin VB.Label lblWork 
  297.          AutoSize        =   -1  'True
  298.          Caption         =   "Work:"
  299.          Height          =   195
  300.          Left            =   105
  301.          TabIndex        =   14
  302.          Top             =   720
  303.          Visible         =   0   'False
  304.          Width           =   435
  305.       End
  306.       Begin VB.Label lblHome 
  307.          AutoSize        =   -1  'True
  308.          Caption         =   "Home:"
  309.          Height          =   195
  310.          Left            =   75
  311.          TabIndex        =   13
  312.          Top             =   360
  313.          Visible         =   0   'False
  314.          Width           =   465
  315.       End
  316.    End
  317.    Begin VB.Frame fraPerson 
  318.       Caption         =   "Person"
  319.       ForeColor       =   &H000000C0&
  320.       Height          =   2535
  321.       Left            =   240
  322.       TabIndex        =   2
  323.       Top             =   960
  324.       Visible         =   0   'False
  325.       Width           =   3255
  326.       Begin VB.TextBox txtZip 
  327.          Height          =   285
  328.          Left            =   840
  329.          MaxLength       =   10
  330.          TabIndex        =   28
  331.          Top             =   2040
  332.          Visible         =   0   'False
  333.          Width           =   975
  334.       End
  335.       Begin VB.TextBox txtState 
  336.          Height          =   285
  337.          Left            =   840
  338.          MaxLength       =   2
  339.          TabIndex        =   27
  340.          Top             =   1680
  341.          Visible         =   0   'False
  342.          Width           =   375
  343.       End
  344.       Begin VB.TextBox txtCity 
  345.          Height          =   285
  346.          Left            =   840
  347.          MaxLength       =   20
  348.          TabIndex        =   26
  349.          Top             =   1320
  350.          Visible         =   0   'False
  351.          Width           =   1455
  352.       End
  353.       Begin VB.TextBox txtAddress2 
  354.          Height          =   285
  355.          Left            =   840
  356.          MaxLength       =   30
  357.          TabIndex        =   25
  358.          Top             =   960
  359.          Visible         =   0   'False
  360.          Width           =   2295
  361.       End
  362.       Begin VB.TextBox txtAddress 
  363.          Height          =   285
  364.          Left            =   840
  365.          MaxLength       =   30
  366.          TabIndex        =   24
  367.          Top             =   600
  368.          Visible         =   0   'False
  369.          Width           =   2295
  370.       End
  371.       Begin VB.TextBox txtName 
  372.          Height          =   285
  373.          Left            =   840
  374.          MaxLength       =   20
  375.          TabIndex        =   23
  376.          Top             =   240
  377.          Visible         =   0   'False
  378.          Width           =   1695
  379.       End
  380.       Begin VB.Label lblZip 
  381.          AutoSize        =   -1  'True
  382.          Caption         =   "Zip/Postal:"
  383.          Height          =   195
  384.          Left            =   45
  385.          TabIndex        =   12
  386.          Top             =   2040
  387.          Visible         =   0   'False
  388.          Width           =   780
  389.       End
  390.       Begin VB.Label lblState 
  391.          AutoSize        =   -1  'True
  392.          Caption         =   "State:"
  393.          Height          =   195
  394.          Left            =   405
  395.          TabIndex        =   11
  396.          Top             =   1680
  397.          Visible         =   0   'False
  398.          Width           =   420
  399.       End
  400.       Begin VB.Label lblCity 
  401.          AutoSize        =   -1  'True
  402.          Caption         =   "City:"
  403.          Height          =   195
  404.          Left            =   525
  405.          TabIndex        =   10
  406.          Top             =   1320
  407.          Visible         =   0   'False
  408.          Width           =   300
  409.       End
  410.       Begin VB.Label lblAddress2 
  411.          AutoSize        =   -1  'True
  412.          Caption         =   "Address:"
  413.          Height          =   195
  414.          Left            =   210
  415.          TabIndex        =   9
  416.          Top             =   960
  417.          Visible         =   0   'False
  418.          Width           =   615
  419.       End
  420.       Begin VB.Label lblAddress 
  421.          AutoSize        =   -1  'True
  422.          Caption         =   "Address:"
  423.          Height          =   195
  424.          Left            =   210
  425.          TabIndex        =   8
  426.          Top             =   600
  427.          Visible         =   0   'False
  428.          Width           =   615
  429.       End
  430.       Begin VB.Label lblName 
  431.          AutoSize        =   -1  'True
  432.          Caption         =   "Name:"
  433.          Height          =   195
  434.          Left            =   360
  435.          TabIndex        =   6
  436.          Top             =   240
  437.          Visible         =   0   'False
  438.          Width           =   465
  439.       End
  440.    End
  441.    Begin ComctlLib.StatusBar staMain 
  442.       Align           =   2  'Align Bottom
  443.       Height          =   255
  444.       Left            =   0
  445.       TabIndex        =   1
  446.       Top             =   5460
  447.       Width           =   6450
  448.       _ExtentX        =   11377
  449.       _ExtentY        =   450
  450.       SimpleText      =   ""
  451.       _Version        =   327682
  452.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  453.          NumPanels       =   3
  454.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  455.             AutoSize        =   2
  456.             Bevel           =   0
  457.             Text            =   "KT Software"
  458.             TextSave        =   "KT Software"
  459.             Key             =   ""
  460.             Object.Tag             =   ""
  461.          EndProperty
  462.          BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  463.             Style           =   6
  464.             Bevel           =   0
  465.             TextSave        =   "10/7/01"
  466.             Key             =   ""
  467.             Object.Tag             =   ""
  468.          EndProperty
  469.          BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  470.             Style           =   5
  471.             Bevel           =   0
  472.             TextSave        =   "7:35 PM"
  473.             Key             =   ""
  474.             Object.Tag             =   ""
  475.          EndProperty
  476.       EndProperty
  477.    End
  478.    Begin VB.Label lblMain 
  479.       AutoSize        =   -1  'True
  480.       Caption         =   "Please select a course of action by clicking a menu or a button."
  481.       ForeColor       =   &H000000FF&
  482.       Height          =   195
  483.       Left            =   960
  484.       TabIndex        =   37
  485.       Top             =   2280
  486.       Width           =   4485
  487.    End
  488.    Begin ComctlLib.ImageList imgMain 
  489.       Left            =   5760
  490.       Top             =   960
  491.       _ExtentX        =   1005
  492.       _ExtentY        =   1005
  493.       BackColor       =   -2147483643
  494.       ImageWidth      =   32
  495.       ImageHeight     =   32
  496.       MaskColor       =   12632256
  497.       _Version        =   327682
  498.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  499.          NumListImages   =   12
  500.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  501.             Picture         =   "frmMain.frx":0442
  502.             Key             =   ""
  503.          EndProperty
  504.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  505.             Picture         =   "frmMain.frx":075C
  506.             Key             =   ""
  507.          EndProperty
  508.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  509.             Picture         =   "frmMain.frx":0A76
  510.             Key             =   ""
  511.          EndProperty
  512.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  513.             Picture         =   "frmMain.frx":0D90
  514.             Key             =   ""
  515.          EndProperty
  516.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  517.             Picture         =   "frmMain.frx":10AA
  518.             Key             =   ""
  519.          EndProperty
  520.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  521.             Picture         =   "frmMain.frx":13C4
  522.             Key             =   ""
  523.          EndProperty
  524.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  525.             Picture         =   "frmMain.frx":16DE
  526.             Key             =   ""
  527.          EndProperty
  528.          BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  529.             Picture         =   "frmMain.frx":19F8
  530.             Key             =   ""
  531.          EndProperty
  532.          BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  533.             Picture         =   "frmMain.frx":1D12
  534.             Key             =   ""
  535.          EndProperty
  536.          BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  537.             Picture         =   "frmMain.frx":202C
  538.             Key             =   ""
  539.          EndProperty
  540.          BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  541.             Picture         =   "frmMain.frx":2346
  542.             Key             =   ""
  543.          EndProperty
  544.          BeginProperty ListImage12 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  545.             Picture         =   "frmMain.frx":2660
  546.             Key             =   ""
  547.          EndProperty
  548.       EndProperty
  549.    End
  550.    Begin VB.Menu mnuFile 
  551.       Caption         =   "&File"
  552.       Begin VB.Menu mnuFNew 
  553.          Caption         =   "&New"
  554.       End
  555.       Begin VB.Menu mnuFSave 
  556.          Caption         =   "&Save"
  557.       End
  558.       Begin VB.Menu mnuFPrint 
  559.          Caption         =   "&Print"
  560.       End
  561.       Begin VB.Menu mnuFSlash 
  562.          Caption         =   "-"
  563.       End
  564.       Begin VB.Menu mnuFExit 
  565.          Caption         =   "E&xit"
  566.       End
  567.    End
  568.    Begin VB.Menu mnuEdit 
  569.       Caption         =   "&Edit"
  570.       Begin VB.Menu mnuESearch 
  571.          Caption         =   "S&earch"
  572.       End
  573.       Begin VB.Menu mnuEDelete 
  574.          Caption         =   "&Delete"
  575.       End
  576.       Begin VB.Menu mnuEClear 
  577.          Caption         =   "&Clear"
  578.       End
  579.    End
  580.    Begin VB.Menu mnuHelp 
  581.       Caption         =   "&Help"
  582.       Begin VB.Menu mnuHContents 
  583.          Caption         =   "C&ontents"
  584.       End
  585.       Begin VB.Menu mnuHAbout 
  586.          Caption         =   "&About"
  587.       End
  588.    End
  589. Attribute VB_Name = "frmMain"
  590. Attribute VB_GlobalNameSpace = False
  591. Attribute VB_Creatable = False
  592. Attribute VB_PredeclaredId = True
  593. Attribute VB_Exposed = False
  594. Option Explicit
  595. '******************************
  596. '   date: 01-18-01
  597. '   name: Keep Your Names
  598. 'purpose: To allow the user to keep names and addresses in a simple, easy
  599. '         yet efficient way.
  600. '         Program notes
  601. '         1). In this program I have used sequential files instead of Random
  602. '             Access. The reason being is that they're much, much easier to use
  603. '             and I think that most people will keep track of no more than 100
  604. '             people. I don't think that this will cause any problems with HD
  605. '             space.
  606. '         2). I am using a code snippet that allows you to press the Enter/Retrun
  607. '             key to navigate the screen instead of having to use the Tab key. I
  608. '             can't believe I didn't use this in my other programs. It's one of
  609. '             those things you're sooo use to you don't think about it.
  610. '         3). The code in the menu items and the toolbar are the same. I like to
  611. '             have the different controls point to one module. I think it makes
  612. '             for tighter code, which makes it easier to read, study and de-bug.
  613. '******************************
  614. 'strGPanel = status panel[staMain.panels(1).text]
  615. 'strGFileName = string variable used in several routines
  616. 'strGExist = used in the FindFile routine
  617.   Dim strGPanel As String, strGFileName As String, strGExist As String
  618. Private Sub Form_Load()
  619.   'This code was added by VB HelpWriter. It was the program I used to write
  620.   'the Help file.
  621.   Call SetAppHelp(Me.hWnd)
  622. End Sub
  623. Private Sub Form_Unload(Cancel As Integer)
  624.   'this code was added by VB HelpWriter
  625.   QuitHelp
  626. End Sub
  627. '******************************
  628. '   name: EClear
  629. 'purpose: Clear the screen for a fresh start.
  630. '******************************
  631. Private Sub mnuEClear_Click()
  632.   Call FramesEnabled
  633.   strGPanel = "(create a new entry)"
  634.   Call ShowPanel
  635.   Call ClearBoxes
  636. End Sub
  637. '******************************
  638. '   name: mnuEDelete
  639. 'purpose: To delete a name from the program.
  640. '******************************
  641. Private Sub mnuEDelete_Click()
  642.   Call FramesEnabled
  643.   strGPanel = "(delete a name)"
  644.   Call ShowPanel
  645.   Call DeleteFile
  646. End Sub
  647. '******************************
  648. '   name: ESearch
  649. 'purpose: Lets the user find a file.
  650. '******************************
  651. Private Sub mnuESearch_Click()
  652.   strGPanel = "(search for a name)"
  653.   Call ShowPanel
  654.   Call LookForFile
  655. End Sub
  656. '******************************
  657. '   name: FExit
  658. 'purpose: Allows the user to gracefully exit the program.
  659. '******************************
  660. Private Sub mnuFExit_Click()
  661.   strGPanel = "(exit the program)"
  662.   Call ShowPanel
  663.   Call UnLoadAllForms
  664. End Sub
  665. '******************************
  666. '   name: FNew
  667. 'purpose: To create a new entry.
  668. '******************************
  669. Private Sub mnuFNew_Click()
  670.   Call FramesEnabled
  671.   strGPanel = "(create a new entry)"
  672.   Call ShowPanel
  673.   Call ClearBoxes
  674. End Sub
  675. '******************************
  676. '   name: FPrint
  677. 'purpose: Allows the user to make a hardcopy of the data on the screen.
  678. '******************************
  679. Private Sub mnuFPrint_Click()
  680.   Call FramesEnabled
  681.   strGPanel = "(print the current screen)"
  682.   Call ShowPanel
  683.   Call PrintFile
  684. End Sub
  685. '******************************
  686. '   name: FSave
  687. 'purpose: Allows the user to save the data on the screen to a data file (.txt).
  688. '******************************
  689. Private Sub mnuFSave_Click()
  690.   Call FramesEnabled
  691.   strGPanel = "(save the current screen)"
  692.   Call ShowPanel
  693.   Call SaveFile
  694. End Sub
  695. '******************************
  696. '   name: HAbout
  697. 'purpose: Show the user a simple 'About' screen. It informs the user how to
  698. '         get in touch with me concerning my programs and directions to my
  699. '         website.
  700. '******************************
  701. Private Sub mnuHAbout_Click()
  702.   frmMain.Hide
  703.   frmAbout.Show
  704. End Sub
  705. Private Sub mnuHContents_Click()
  706.   strGPanel = "(show the contents screen)"
  707.   Call ShowPanel
  708.   ShowHelpContents
  709. End Sub
  710. '******************************
  711. '   name: tlbMain
  712. 'purpose: Allows the user an alternative way to navigate the program.
  713. '   note: The Button.Key is the word you entered in the 'key' textbox on the
  714. '         property sheet of either the imagelist or the toolbar. (Mine are
  715. '         entered on the toolbar property sheet.)
  716. '******************************
  717. Private Sub tlbMain_ButtonClick(ByVal Button As ComctlLib.Button)
  718.   Select Case Button.Key
  719.     Case "new"
  720.       Call FramesEnabled
  721.       strGPanel = "(create a new entry)"
  722.       Call ShowPanel
  723.       Call ClearBoxes
  724.     Case "save"
  725.       Call FramesEnabled
  726.       strGPanel = "(save the current screen)"
  727.       Call ShowPanel
  728.       Call SaveFile
  729.     Case "print"
  730.       Call FramesEnabled
  731.       strGPanel = "(print the current screen)"
  732.       Call ShowPanel
  733.       Call PrintFile
  734.     Case "search"
  735.       strGPanel = "(search for a name)"
  736.       Call ShowPanel
  737.       Call LookForFile
  738.     Case "delete"
  739.       Call FramesEnabled
  740.       strGPanel = "(delete a name)"
  741.       Call ShowPanel
  742.       Call DeleteFile
  743.     Case "clear"
  744.       Call FramesEnabled
  745.       strGPanel = "(clear the screen)"
  746.       Call ShowPanel
  747.       Call ClearBoxes
  748.     Case "help"
  749.       strGPanel = "(show the contents screen)"
  750.       Call ShowPanel
  751.       Call ShowHelpContents
  752.     Case "exit"
  753.       strGPanel = "(exit the program)"
  754.       Call ShowPanel
  755.       Call UnLoadAllForms
  756.     Case Else '"falls thru" if none of the 'Case' keywords are selected
  757.       Call FramesEnabled
  758.       strGPanel = "KT Software"
  759.       Call ShowPanel
  760.   End Select
  761. End Sub
  762. '******************************
  763. '   name: ShowPanel
  764. 'purpose: To display, in the panel, a message for the user. I like tooltips but
  765. '         they can be annoying when you're used to using the program. This way
  766. '         you know what this item is for but it's unobtrusive.
  767. '******************************
  768. Private Sub ShowPanel()
  769.   lblMain.Visible = False 'this label is the red message you see when you first
  770.                           'start the program
  771.   staMain.Panels(1).Text = strGPanel
  772. End Sub
  773. '******************************
  774. '   name: UnLoadAllForms
  775. 'purpose: To unload all of the forms at the same time, IF the user wants to
  776. '         exit the program.
  777. '******************************
  778. Private Sub UnLoadAllForms()
  779.   Dim Form As Form
  780.   Dim strMsg As String, strTitle As String, strAnswer As String
  781.   Dim intStyle As Integer
  782.   Call FramesUnEnabled
  783.   'char$(13) - carriage return
  784.   strMsg = "You have indicated you wish to exit the program." + Chr$(13)
  785.   strMsg = strMsg + "Is this correct?"
  786.   strTitle = "Confirm"
  787.   'vbSystemModal - the user HAS to click a button
  788.   intStyle = vbQuestion + vbOKCancel + vbSystemModal
  789.   strAnswer = MsgBox(strMsg, intStyle, strTitle)
  790.   If strAnswer = vbOK Then
  791.     For Each Form In Forms
  792.       Unload Form
  793.       Set Form = Nothing
  794.     Next Form
  795.   Else
  796.     Call FramesEnabled
  797.     Exit Sub 'simply returns to the state you were before you clicked 'exit'
  798.   End If
  799. End Sub
  800. '******************************
  801. '   name: FramesEnabled
  802. 'purpose: To enable ALL frames, labels and textboxes.
  803. '******************************
  804. Private Sub FramesEnabled()
  805.   fraPerson.Visible = True
  806.       lblName.Visible = True: txtName.Visible = True
  807.    lblAddress.Visible = True: txtAddress.Visible = True
  808.   lblAddress2.Visible = True: txtAddress2.Visible = True
  809.       lblCity.Visible = True: txtCity.Visible = True
  810.      lblState.Visible = True: txtState.Visible = True
  811.        lblZip.Visible = True: txtZip.Visible = True
  812.   fraPhone.Visible = True
  813.   lblHome.Visible = True: txtHome.Visible = True
  814.   lblWork.Visible = True: txtWork.Visible = True
  815.    lblExt.Visible = True: txtExt.Visible = True
  816.   lblCell.Visible = True: txtCell.Visible = True
  817.    lblFax.Visible = True: txtFax.Visible = True
  818.   fraStatus.Visible = True
  819.   optFriend.Visible = True: optFamily.Visible = True
  820.   fraMisc.Visible = True
  821.   lblBirth.Visible = True: txtBirth.Visible = True
  822.     lblWed.Visible = True: txtWed.Visible = True
  823.   lblemail.Visible = True: txtEmail.Visible = True
  824.   chkMain.Visible = True
  825.   txtName.SetFocus
  826. End Sub
  827. '******************************
  828. '   name: FramesUnEnabled
  829. 'purpose: To DISable all frames, labels and textboxes.
  830. '******************************
  831. Private Sub FramesUnEnabled()
  832.   fraPerson.Visible = False
  833.       lblName.Visible = False: txtName.Visible = False
  834.    lblAddress.Visible = False: txtAddress.Visible = False
  835.   lblAddress2.Visible = False: txtAddress2.Visible = False
  836.       lblCity.Visible = False: txtCity.Visible = False
  837.      lblState.Visible = False: txtState.Visible = False
  838.        lblZip.Visible = False: txtZip.Visible = False
  839.   fraPhone.Visible = False
  840.   lblHome.Visible = False: txtHome.Visible = False
  841.   lblWork.Visible = False: txtWork.Visible = False
  842.    lblExt.Visible = False: txtExt.Visible = False
  843.   lblCell.Visible = False: txtCell.Visible = False
  844.    lblFax.Visible = False: txtFax.Visible = False
  845.   fraStatus.Visible = False
  846.   optFriend.Visible = False: optFamily.Visible = False
  847.   fraMisc.Visible = False
  848.   lblBirth.Visible = False: txtBirth.Visible = False
  849.     lblWed.Visible = False: txtWed.Visible = False
  850.   lblemail.Visible = False: txtEmail.Visible = False
  851.   chkMain.Visible = False
  852. End Sub
  853. '******************************
  854. '   name: ClearBoxes
  855. 'purpose: To clear all of the textboxes, on a form, quickly.
  856. '******************************
  857. Private Sub ClearBoxes()
  858.   Dim intCCounter As Integer
  859.   For intCCounter = 0 To frmMain.Controls.Count - 1
  860.     If TypeOf frmMain.Controls(intCCounter) Is TextBox Then
  861.       frmMain.Controls(intCCounter).Text = ""
  862.     End If
  863.   Next intCCounter
  864.   txtName.SetFocus
  865. End Sub
  866. '******************************
  867. '   name: FindFile
  868. 'purpose: To see if the file exists.
  869. '   note: I picked this little gem off the net but I can't remember where. This
  870. '         uses the Dir$ function to see if the file exists. The idea is that if
  871. '         strGFileName equals anything other than "", then it should be the file
  872. '         you're looking for.
  873. '******************************
  874. Private Sub FindFile()
  875.   If Dir(App.Path + "\" + strGFileName) <> "" Then 'the file was not found
  876.     strGExist = "yes"
  877.   Else
  878.     strGExist = "no"
  879.   End If
  880. End Sub
  881. '******************************
  882. '   name: DeleteFile
  883. 'purpose: To allow the user to delete a name. You are actually deleteing the
  884. '         data file.
  885. '******************************
  886. Private Sub DeleteFile()
  887.   Dim strEMsg As String, strETitle As String, strEAnswer As String
  888.   Dim intEStyle As Integer
  889.   strGFileName = txtName.Text
  890.   Call FindFile
  891.   Call FramesUnEnabled
  892.   If strGExist = "yes" Then 'file was found
  893.     strEMsg = "Do you wish to delete: " & strGFileName + "?"
  894.     strETitle = "Confirm"
  895.     intEStyle = vbOKCancel + vbCritical + vbSystemModal
  896.     strEAnswer = MsgBox(strEMsg, intEStyle, strETitle)
  897.     If strEAnswer = vbOK Then 'user wants to delete the file
  898.       Kill (App.Path + "\" + strGFileName) 'I think that you MUST give the full
  899.                                            'path for this to work. I kept getting
  900.                                            'an error (path not found) until I
  901.                                            'added the app.path
  902.       Call FramesEnabled
  903.       Call ClearBoxes
  904.       Exit Sub
  905.     Else 'Cancel was clicked
  906.       Call FramesEnabled
  907.       Exit Sub
  908.     End If
  909.   Else 'file doesn't exist
  910.     strEMsg = "This file DOESN'T exist."
  911.     strETitle = "Error"
  912.     intEStyle = vbOKOnly + vbInformation + vbSystemModal
  913.     strEAnswer = MsgBox(strEMsg, intEStyle, strETitle)
  914.     If strEAnswer = vbOK Then
  915.       Call FramesEnabled
  916.       Exit Sub
  917.     End If
  918.   End If 'strGExist
  919. End Sub
  920. '******************************
  921. '   name: SaveFile
  922. 'purpose: Allows the user to save the data on the screen. It will use the name
  923. '         entered in the txtName.text as the filename.
  924. '   note: FreeFile is a vbfunction that keeps track of file numbers for you.
  925. '         Using this function, you won't have to worry about conflicting file
  926. '         numbers.
  927. '******************************
  928. Private Sub SaveFile()
  929.   Dim strName As String, strAddress As String, strAddress2 As String
  930.   Dim strCity As String, strState As String, strZip As String
  931.   Dim strHome As String, strWork As String, strExt As String, strCell As String
  932.   Dim strFax As String, strBirth As String, strWed As String
  933.   Dim strEmail As String
  934.   Dim intFileNumber As Integer, intFriend As Integer, intFamily As Integer
  935.   Dim intCheckBox As Integer
  936.       strName = txtName.Text
  937.    strAddress = txtAddress.Text
  938.   strAddress2 = txtAddress2.Text
  939.       strCity = txtCity.Text
  940.      strState = txtState.Text
  941.        strZip = txtZip.Text
  942.       strHome = txtHome.Text
  943.       strWork = txtWork.Text
  944.        strExt = txtExt.Text
  945.       strCell = txtCell.Text
  946.        strFax = txtFax.Text
  947.      strBirth = txtBirth.Text
  948.        strWed = txtWed.Text
  949.      strEmail = txtEmail.Text
  950.   'option boxes
  951.   If optFriend.Value = True Then 'it's checked
  952.     intFriend = 1
  953.     intFamily = 0 'un-checked
  954.   Else
  955.     intFamily = 1
  956.     intFriend = 0
  957.   End If
  958.   'checkbox -- 0 = un-checked  1 = checked  2 = dimmed
  959.   If chkMain.Value = 1 Then
  960.     intCheckBox = 1
  961.   Else
  962.     intCheckBox = 0
  963.   End If
  964.   strGFileName = txtName.Text
  965.   intFileNumber = FreeFile
  966.   Open (App.Path + "\" + strGFileName) For Output As #intFileNumber
  967.     Write #intFileNumber, strName, strAddress, strAddress2, strCity, strState, _
  968.                           strZip, strHome, strWork, strExt, strCell, strFax, _
  969.                           strBirth, strWed, strEmail, intFriend, intFamily, _
  970.                           intCheckBox
  971.   Close #intFileNumber
  972. End Sub
  973. '******************************
  974. '   name: LookForFile
  975. 'purpose: To find the file, if it exists, and display the data on the screen.
  976. '   note: I used an Input box because I couldn't think of a different but classy
  977. '         way of getting the input from the user.
  978. '******************************
  979. Private Sub LookForFile()
  980.   'input box
  981.   Dim strIMsg As String, strITitle As String
  982.   'msgbox
  983.   Dim strLMsg As String, strLTitle, strLAnswer As String
  984.   Dim intLStyle As Integer
  985.   'file
  986.   Dim strName As String, strAddress As String, strAddress2 As String
  987.   Dim strCity As String, strState As String, strZip As String
  988.   Dim strHome As String, strWork As String, strExt As String, strCell As String
  989.   Dim strFax As String, strBirth As String, strWed As String
  990.   Dim strEmail As String
  991.   Dim intFileNumber As Integer, intFriend As Integer, intFamily As Integer
  992.   Dim intCheckBox As Integer
  993.   Call FramesUnEnabled
  994.   'Char$(13) = line feed
  995.   'this is used to lower the strIMsg string closer to the text box
  996.   strIMsg = Chr$(13) + Chr$(13) + Chr$(13) + Chr$(13) + Chr$(13)
  997.   strIMsg = strIMsg + "Please enter the name you wish to look for:"
  998.   strITitle = "Search"
  999.   strGFileName = InputBox(strIMsg, strITitle)
  1000.   If strGFileName = "" Then 'Cancel was clicked
  1001.     Call FramesEnabled
  1002.     Exit Sub
  1003.   End If
  1004.   Call FindFile
  1005.   If strGExist = "yes" Then
  1006.     intFileNumber = FreeFile
  1007.     Open (App.Path + "\" + strGFileName) For Input As #intFileNumber
  1008.       Do While Not EOF(intFileNumber)
  1009.         Input #intFileNumber, strName, strAddress, strAddress2, strCity, _
  1010.                               strState, strZip, strHome, strWork, strExt, _
  1011.                               strCell, strFax, strBirth, strWed, strEmail, _
  1012.                               intFriend, intFamily, intCheckBox
  1013.       Loop
  1014.     Close #intFileNumber
  1015.     'display the data on the screen
  1016.     txtName.Text = strName
  1017.     txtAddress.Text = strAddress
  1018.     txtAddress2.Text = strAddress2
  1019.     txtCity.Text = strCity
  1020.     txtState.Text = strState
  1021.     txtZip.Text = strZip
  1022.     txtHome.Text = strHome
  1023.     txtWork.Text = strWork
  1024.     txtExt.Text = strExt
  1025.     txtCell.Text = strCell
  1026.     txtFax.Text = strFax
  1027.     txtBirth.Text = strBirth
  1028.     txtWed.Text = strWed
  1029.     txtEmail.Text = strEmail
  1030.     'option boxes
  1031.     If intFriend = 1 Then
  1032.       optFriend.Value = True
  1033.     Else
  1034.       optFamily.Value = True
  1035.     End If
  1036.     'checkbox
  1037.     If intCheckBox = 1 Then
  1038.       chkMain.Value = 1
  1039.     Else
  1040.       chkMain.Value = 0
  1041.     End If
  1042.     Call FramesEnabled
  1043.   Else 'strGExist = "no"
  1044.     strLMsg = "This file DOESN'T exist."
  1045.     strLTitle = "Error"
  1046.     intLStyle = vbOKOnly + vbInformation + vbSystemModal
  1047.     strLAnswer = MsgBox(strLMsg, intLStyle, strLTitle)
  1048.     If strLAnswer = vbOK Then
  1049.       Call FramesEnabled
  1050.       Exit Sub
  1051.     End If
  1052.   End If 'strGExist
  1053. End Sub
  1054. '******************************
  1055. '   name: PrintFile
  1056. 'purpose: Allows the user to make a hard copy of the current screen data.
  1057. '   note: .Flags = &H40 will show the user the print setup page. This serves
  1058. '         to allow the user to make adjustments, such as the number of copies
  1059. '         etc, and as a silent reminder to the user to have the printer turned
  1060. '         on and full of paper.
  1061. '******************************
  1062. Private Sub PrintFile()
  1063.   On Error GoTo dlgError
  1064.   With dlgMain
  1065.     .CancelError = True 'if the user clicks 'Cancel' no error will occur
  1066.     .Flags = &H40
  1067.     .ShowPrinter
  1068.   End With
  1069.   'person
  1070.   Printer.Print 'blank line
  1071.   Printer.Print "Date: " & Date
  1072.   Printer.Print
  1073.   Printer.Print "    Name: " & txtName.Text
  1074.   Printer.Print " Address: " & txtAddress.Text
  1075.   Printer.Print "Address2: " & txtAddress2.Text
  1076.   Printer.Print "    City: " & txtCity.Text
  1077.   Printer.Print "   State: " & txtState.Text
  1078.   Printer.Print "     Zip: " & txtZip.Text
  1079.   'phones
  1080.   Printer.Print
  1081.   Printer.Print "    Home: " & txtHome.Text
  1082.   Printer.Print "    Work: " & txtWork.Text
  1083.   Printer.Print "     Ext: " & txtExt.Text
  1084.   Printer.Print "    Cell: " & txtCell.Text
  1085.   Printer.Print "     Fax: " & txtFax.Text
  1086.   'staus
  1087.   Printer.Print
  1088.   If optFriend.Value = True Then
  1089.     Printer.Print "   Friend"
  1090.   Else
  1091.     Printer.Print "   Family"
  1092.   End If
  1093.   Printer.Print
  1094.   If chkMain.Value = 1 Then
  1095.     Printer.Print "This name is on your X-mas list"
  1096.   End If
  1097.   'misc
  1098.   Printer.Print
  1099.   Printer.Print "   Birth: " & txtBirth.Text
  1100.   Printer.Print " Wedding: " & txtWed.Text
  1101.   Printer.Print "   Email: " & txtEmail.Text
  1102.   'end print session
  1103.   Printer.EndDoc
  1104. dlgError:
  1105.   Exit Sub
  1106. End Sub
  1107. '******************************
  1108. '   name: KeyPress
  1109. 'purpose: The purpose of the following code is to allow the user to press the
  1110. '         Return/Enter key instead of the Tab key.
  1111. '******************************
  1112. Private Sub txtAddress_KeyPress(KeyAscii As Integer)
  1113.   If KeyAscii = 13 Then
  1114.     SendKeys "{tab}"
  1115.     KeyAscii = 0
  1116.   End If
  1117. End Sub
  1118. Private Sub txtAddress2_KeyPress(KeyAscii As Integer)
  1119.   If KeyAscii = 13 Then
  1120.     SendKeys "{tab}"
  1121.     KeyAscii = 0
  1122.   End If
  1123. End Sub
  1124. Private Sub txtBirth_KeyPress(KeyAscii As Integer)
  1125.   If KeyAscii = 13 Then
  1126.     SendKeys "{tab}"
  1127.     KeyAscii = 0
  1128.   End If
  1129. End Sub
  1130. Private Sub txtCell_KeyPress(KeyAscii As Integer)
  1131.   If KeyAscii = 13 Then
  1132.     SendKeys "{tab}"
  1133.     KeyAscii = 0
  1134.   End If
  1135. End Sub
  1136. Private Sub txtCity_KeyPress(KeyAscii As Integer)
  1137.   If KeyAscii = 13 Then
  1138.     SendKeys "{tab}"
  1139.     KeyAscii = 0
  1140.   End If
  1141. End Sub
  1142. Private Sub txtEmail_KeyPress(KeyAscii As Integer)
  1143.   If KeyAscii = 13 Then
  1144.     SendKeys "{tab}"
  1145.     KeyAscii = 0
  1146.   End If
  1147. End Sub
  1148. Private Sub txtExt_KeyPress(KeyAscii As Integer)
  1149.   If KeyAscii = 13 Then
  1150.     SendKeys "{tab}"
  1151.     KeyAscii = 0
  1152.   End If
  1153. End Sub
  1154. Private Sub txtFax_KeyPress(KeyAscii As Integer)
  1155.   If KeyAscii = 13 Then
  1156.     SendKeys "{tab}"
  1157.     KeyAscii = 0
  1158.   End If
  1159. End Sub
  1160. Private Sub txtHome_KeyPress(KeyAscii As Integer)
  1161.   If KeyAscii = 13 Then
  1162.     SendKeys "{tab}"
  1163.     KeyAscii = 0
  1164.   End If
  1165. End Sub
  1166. Private Sub txtName_KeyPress(KeyAscii As Integer)
  1167.   If KeyAscii = 13 Then
  1168.     SendKeys "{tab}"
  1169.     KeyAscii = 0
  1170.   End If
  1171. End Sub
  1172. Private Sub txtState_KeyPress(KeyAscii As Integer)
  1173.   If KeyAscii = 13 Then
  1174.     SendKeys "{tab}"
  1175.     KeyAscii = 0
  1176.   End If
  1177. End Sub
  1178. Private Sub txtWed_KeyPress(KeyAscii As Integer)
  1179.   If KeyAscii = 13 Then
  1180.     SendKeys "{tab}"
  1181.     KeyAscii = 0
  1182.   End If
  1183. End Sub
  1184. Private Sub txtWork_KeyPress(KeyAscii As Integer)
  1185.   If KeyAscii = 13 Then
  1186.     SendKeys "{tab}"
  1187.     KeyAscii = 0
  1188.   End If
  1189. End Sub
  1190. Private Sub txtZip_KeyPress(KeyAscii As Integer)
  1191.   If KeyAscii = 13 Then
  1192.     SendKeys "{tab}"
  1193.     KeyAscii = 0
  1194.   End If
  1195. End Sub
  1196.