home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch05 / keycombo / keycombo.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-06-05  |  15.1 KB  |  474 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "List Search"
  4.    ClientHeight    =   3990
  5.    ClientLeft      =   2400
  6.    ClientTop       =   1650
  7.    ClientWidth     =   6330
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3990
  10.    ScaleWidth      =   6330
  11.    Begin VB.Frame Frame2 
  12.       Height          =   3090
  13.       Left            =   2910
  14.       TabIndex        =   13
  15.       Top             =   75
  16.       Width           =   3330
  17.       Begin VB.TextBox Text4 
  18.          BeginProperty Font 
  19.             Name            =   "MS Sans Serif"
  20.             Size            =   9.75
  21.             Charset         =   0
  22.             Weight          =   400
  23.             Underline       =   0   'False
  24.             Italic          =   0   'False
  25.             Strikethrough   =   0   'False
  26.          EndProperty
  27.          Height          =   360
  28.          Left            =   90
  29.          Locked          =   -1  'True
  30.          TabIndex        =   17
  31.          Top             =   2610
  32.          Width           =   3135
  33.       End
  34.       Begin VB.TextBox Text3 
  35.          BeginProperty Font 
  36.             Name            =   "MS Sans Serif"
  37.             Size            =   9.75
  38.             Charset         =   0
  39.             Weight          =   400
  40.             Underline       =   0   'False
  41.             Italic          =   0   'False
  42.             Strikethrough   =   0   'False
  43.          EndProperty
  44.          Height          =   360
  45.          Left            =   90
  46.          Locked          =   -1  'True
  47.          TabIndex        =   16
  48.          Top             =   1800
  49.          Width           =   3135
  50.       End
  51.       Begin VB.TextBox Text2 
  52.          BeginProperty Font 
  53.             Name            =   "MS Sans Serif"
  54.             Size            =   9.75
  55.             Charset         =   0
  56.             Weight          =   400
  57.             Underline       =   0   'False
  58.             Italic          =   0   'False
  59.             Strikethrough   =   0   'False
  60.          EndProperty
  61.          Height          =   360
  62.          Left            =   90
  63.          Locked          =   -1  'True
  64.          TabIndex        =   15
  65.          Top             =   1050
  66.          Width           =   2760
  67.       End
  68.       Begin VB.TextBox Text1 
  69.          BeginProperty Font 
  70.             Name            =   "MS Sans Serif"
  71.             Size            =   9.75
  72.             Charset         =   0
  73.             Weight          =   400
  74.             Underline       =   0   'False
  75.             Italic          =   0   'False
  76.             Strikethrough   =   0   'False
  77.          EndProperty
  78.          Height          =   360
  79.          Left            =   90
  80.          TabIndex        =   14
  81.          Top             =   420
  82.          Width           =   2295
  83.       End
  84.       Begin VB.Label Label4 
  85.          Caption         =   "Name"
  86.          BeginProperty Font 
  87.             Name            =   "MS Sans Serif"
  88.             Size            =   9.75
  89.             Charset         =   0
  90.             Weight          =   400
  91.             Underline       =   0   'False
  92.             Italic          =   0   'False
  93.             Strikethrough   =   0   'False
  94.          EndProperty
  95.          Height          =   240
  96.          Left            =   90
  97.          TabIndex        =   21
  98.          Top             =   165
  99.          Width           =   1215
  100.       End
  101.       Begin VB.Label Label5 
  102.          Caption         =   "SSN"
  103.          BeginProperty Font 
  104.             Name            =   "MS Sans Serif"
  105.             Size            =   9.75
  106.             Charset         =   0
  107.             Weight          =   400
  108.             Underline       =   0   'False
  109.             Italic          =   0   'False
  110.             Strikethrough   =   0   'False
  111.          EndProperty
  112.          Height          =   225
  113.          Left            =   90
  114.          TabIndex        =   20
  115.          Top             =   825
  116.          Width           =   1125
  117.       End
  118.       Begin VB.Label Label6 
  119.          Caption         =   "American Express"
  120.          BeginProperty Font 
  121.             Name            =   "MS Sans Serif"
  122.             Size            =   9.75
  123.             Charset         =   0
  124.             Weight          =   400
  125.             Underline       =   0   'False
  126.             Italic          =   0   'False
  127.             Strikethrough   =   0   'False
  128.          EndProperty
  129.          Height          =   225
  130.          Left            =   90
  131.          TabIndex        =   19
  132.          Top             =   1500
  133.          Width           =   1665
  134.       End
  135.       Begin VB.Label Label7 
  136.          Caption         =   "VISA"
  137.          BeginProperty Font 
  138.             Name            =   "MS Sans Serif"
  139.             Size            =   9.75
  140.             Charset         =   0
  141.             Weight          =   400
  142.             Underline       =   0   'False
  143.             Italic          =   0   'False
  144.             Strikethrough   =   0   'False
  145.          EndProperty
  146.          Height          =   225
  147.          Left            =   90
  148.          TabIndex        =   18
  149.          Top             =   2355
  150.          Width           =   1890
  151.       End
  152.    End
  153.    Begin VB.ComboBox Combo3 
  154.       BeginProperty Font 
  155.          Name            =   "MS Sans Serif"
  156.          Size            =   9.75
  157.          Charset         =   0
  158.          Weight          =   400
  159.          Underline       =   0   'False
  160.          Italic          =   0   'False
  161.          Strikethrough   =   0   'False
  162.       EndProperty
  163.       Height          =   360
  164.       Left            =   150
  165.       Sorted          =   -1  'True
  166.       Style           =   2  'Dropdown List
  167.       TabIndex        =   3
  168.       Top             =   2610
  169.       Width           =   2535
  170.    End
  171.    Begin VB.ComboBox Combo2 
  172.       BeginProperty Font 
  173.          Name            =   "MS Sans Serif"
  174.          Size            =   9.75
  175.          Charset         =   0
  176.          Weight          =   400
  177.          Underline       =   0   'False
  178.          Italic          =   0   'False
  179.          Strikethrough   =   0   'False
  180.       EndProperty
  181.       Height          =   360
  182.       Left            =   150
  183.       Sorted          =   -1  'True
  184.       Style           =   2  'Dropdown List
  185.       TabIndex        =   4
  186.       Top             =   1680
  187.       Width           =   2535
  188.    End
  189.    Begin VB.ComboBox Combo1 
  190.       BeginProperty Font 
  191.          Name            =   "MS Sans Serif"
  192.          Size            =   9.75
  193.          Charset         =   0
  194.          Weight          =   400
  195.          Underline       =   0   'False
  196.          Italic          =   0   'False
  197.          Strikethrough   =   0   'False
  198.       EndProperty
  199.       Height          =   360
  200.       Left            =   150
  201.       Sorted          =   -1  'True
  202.       Style           =   2  'Dropdown List
  203.       TabIndex        =   5
  204.       Top             =   720
  205.       Width           =   2535
  206.    End
  207.    Begin VB.CommandButton AddButton 
  208.       Caption         =   "Add New"
  209.       BeginProperty Font 
  210.          Name            =   "MS Sans Serif"
  211.          Size            =   9.75
  212.          Charset         =   0
  213.          Weight          =   400
  214.          Underline       =   0   'False
  215.          Italic          =   0   'False
  216.          Strikethrough   =   0   'False
  217.       EndProperty
  218.       Height          =   495
  219.       Left            =   5010
  220.       TabIndex        =   0
  221.       Top             =   3375
  222.       Width           =   1215
  223.    End
  224.    Begin VB.CommandButton CancelButton 
  225.       Caption         =   "Cancel"
  226.       BeginProperty Font 
  227.          Name            =   "MS Sans Serif"
  228.          Size            =   9.75
  229.          Charset         =   0
  230.          Weight          =   400
  231.          Underline       =   0   'False
  232.          Italic          =   0   'False
  233.          Strikethrough   =   0   'False
  234.       EndProperty
  235.       Height          =   495
  236.       Left            =   2955
  237.       TabIndex        =   2
  238.       Top             =   3375
  239.       Visible         =   0   'False
  240.       Width           =   1215
  241.    End
  242.    Begin VB.CommandButton OKButton 
  243.       Caption         =   "OK"
  244.       BeginProperty Font 
  245.          Name            =   "MS Sans Serif"
  246.          Size            =   9.75
  247.          Charset         =   0
  248.          Weight          =   400
  249.          Underline       =   0   'False
  250.          Italic          =   0   'False
  251.          Strikethrough   =   0   'False
  252.       EndProperty
  253.       Height          =   495
  254.       Left            =   5010
  255.       TabIndex        =   1
  256.       Top             =   3375
  257.       Width           =   1215
  258.    End
  259.    Begin VB.Frame Frame1 
  260.       Height          =   3075
  261.       Left            =   0
  262.       TabIndex        =   9
  263.       Top             =   90
  264.       Width           =   2775
  265.       Begin VB.Label Label10 
  266.          Caption         =   "Search by VISA #"
  267.          BeginProperty Font 
  268.             Name            =   "MS Sans Serif"
  269.             Size            =   9.75
  270.             Charset         =   0
  271.             Weight          =   400
  272.             Underline       =   0   'False
  273.             Italic          =   0   'False
  274.             Strikethrough   =   0   'False
  275.          EndProperty
  276.          Height          =   270
  277.          Left            =   105
  278.          TabIndex        =   12
  279.          Top             =   2190
  280.          Width           =   2160
  281.       End
  282.       Begin VB.Label Label9 
  283.          Caption         =   "Search by AMEX #"
  284.          BeginProperty Font 
  285.             Name            =   "MS Sans Serif"
  286.             Size            =   9.75
  287.             Charset         =   0
  288.             Weight          =   400
  289.             Underline       =   0   'False
  290.             Italic          =   0   'False
  291.             Strikethrough   =   0   'False
  292.          EndProperty
  293.          Height          =   255
  294.          Left            =   105
  295.          TabIndex        =   11
  296.          Top             =   1260
  297.          Width           =   2205
  298.       End
  299.       Begin VB.Label Label8 
  300.          Caption         =   "Search by SSN"
  301.          BeginProperty Font 
  302.             Name            =   "MS Sans Serif"
  303.             Size            =   9.75
  304.             Charset         =   0
  305.             Weight          =   400
  306.             Underline       =   0   'False
  307.             Italic          =   0   'False
  308.             Strikethrough   =   0   'False
  309.          EndProperty
  310.          Height          =   225
  311.          Left            =   105
  312.          TabIndex        =   10
  313.          Top             =   285
  314.          Width           =   1620
  315.       End
  316.    End
  317.    Begin VB.Label Label3 
  318.       Caption         =   "VISA"
  319.       BeginProperty Font 
  320.          Name            =   "MS Sans Serif"
  321.          Size            =   9.75
  322.          Charset         =   0
  323.          Weight          =   400
  324.          Underline       =   0   'False
  325.          Italic          =   0   'False
  326.          Strikethrough   =   0   'False
  327.       EndProperty
  328.       Height          =   195
  329.       Left            =   135
  330.       TabIndex        =   8
  331.       Top             =   1770
  332.       Width           =   1515
  333.    End
  334.    Begin VB.Label Label2 
  335.       Caption         =   "American Express"
  336.       BeginProperty Font 
  337.          Name            =   "MS Sans Serif"
  338.          Size            =   9.75
  339.          Charset         =   0
  340.          Weight          =   400
  341.          Underline       =   0   'False
  342.          Italic          =   0   'False
  343.          Strikethrough   =   0   'False
  344.       EndProperty
  345.       Height          =   255
  346.       Left            =   120
  347.       TabIndex        =   7
  348.       Top             =   1005
  349.       Width           =   1905
  350.    End
  351.    Begin VB.Label Label1 
  352.       Caption         =   "SSN"
  353.       BeginProperty Font 
  354.          Name            =   "MS Sans Serif"
  355.          Size            =   9.75
  356.          Charset         =   0
  357.          Weight          =   400
  358.          Underline       =   0   'False
  359.          Italic          =   0   'False
  360.          Strikethrough   =   0   'False
  361.       EndProperty
  362.       Height          =   270
  363.       Left            =   120
  364.       TabIndex        =   6
  365.       Top             =   285
  366.       Width           =   1590
  367.    End
  368. Attribute VB_Name = "Form1"
  369. Attribute VB_GlobalNameSpace = False
  370. Attribute VB_Creatable = False
  371. Attribute VB_PredeclaredId = True
  372. Attribute VB_Exposed = False
  373. Dim DataArray(999, 3) As String
  374. Dim ArrayIndex As Integer
  375. Sub ClearFields()
  376.     Text1.Text = ""
  377.     Text2.Text = ""
  378.     Text2.Locked = False
  379.     Text3.Text = ""
  380.     Text3.Locked = False
  381.     Text4.Text = ""
  382.     Text4.Locked = False
  383.     AddButton.Visible = False
  384.     OKButton.Visible = True
  385.     CancelButton.Visible = True
  386. End Sub
  387. Sub ShowButtons()
  388.     OKButton.Visible = False
  389.     CancelButton.Visible = False
  390.     AddButton.Visible = True
  391.     Text2.Locked = True
  392.     Text3.Locked = True
  393.     Text4.Locked = True
  394. End Sub
  395. Private Sub AddButton_Click()
  396.     ClearFields
  397.     Text1.SetFocus
  398. End Sub
  399. Private Sub CancelButton_Click()
  400.     ShowButtons
  401.     Combo1_Click
  402. End Sub
  403. Private Sub Combo1_Click()
  404.     If Combo1.ListIndex < 0 Then
  405.         Text1.Text = ""
  406.         Text2.Text = ""
  407.         Text3.Text = ""
  408.         Text4.Text = ""
  409.         Exit Sub
  410.     End If
  411.     ItemIndex = Combo1.ItemData(Combo1.ListIndex)
  412.     Text1.Text = DataArray(ItemIndex, 0)
  413.     Text2.Text = DataArray(ItemIndex, 1)
  414.     Text3.Text = DataArray(ItemIndex, 2)
  415.     Text4.Text = DataArray(ItemIndex, 3)
  416. End Sub
  417. Private Sub Combo2_Click()
  418.     If Combo2.ListIndex < 0 Then
  419.         Text1.Text = ""
  420.         Text2.Text = ""
  421.         Text3.Text = ""
  422.         Text4.Text = ""
  423.         Exit Sub
  424.     End If
  425.     ItemIndex = Combo2.ItemData(Combo2.ListIndex)
  426.     Text1.Text = DataArray(ItemIndex, 0)
  427.     Text2.Text = DataArray(ItemIndex, 1)
  428.     Text3.Text = DataArray(ItemIndex, 2)
  429.     Text4.Text = DataArray(ItemIndex, 3)
  430. End Sub
  431. Private Sub Combo3_Click()
  432.     If Combo3.ListIndex < 0 Then
  433.         Text1.Text = ""
  434.         Text2.Text = ""
  435.         Text3.Text = ""
  436.         Text4.Text = ""
  437.         Exit Sub
  438.     End If
  439.     ItemIndex = Combo3.ItemData(Combo3.ListIndex)
  440.     Text1.Text = DataArray(ItemIndex, 0)
  441.     Text2.Text = DataArray(ItemIndex, 1)
  442.     Text3.Text = DataArray(ItemIndex, 2)
  443.     Text4.Text = DataArray(ItemIndex, 3)
  444. End Sub
  445. Private Sub OKButton_Click()
  446.     Key = Trim(Text1.Text)
  447.     If Key = "" Then
  448.         MsgBox "Key field must be non-mepty"
  449.         Exit Sub
  450.     End If
  451.     ArrayIndex = ArrayIndex + 1
  452.     If Text2.Text <> "" Then
  453.         Combo1.AddItem Text2.Text
  454.         Combo1.ItemData(Combo1.NewIndex) = ArrayIndex
  455.     End If
  456.     If Text3.Text <> "" Then
  457.         Combo2.AddItem Text3.Text
  458.         Combo2.ItemData(Combo2.NewIndex) = ArrayIndex
  459.     End If
  460.     If Text4.Text <> "" Then
  461.         Combo3.AddItem Text4.Text
  462.         Combo3.ItemData(Combo3.NewIndex) = ArrayIndex
  463.     End If
  464.     DataArray(ArrayIndex, 0) = Text1.Text
  465.     DataArray(ArrayIndex, 1) = Text2.Text
  466.     DataArray(ArrayIndex, 2) = Text3.Text
  467.     DataArray(ArrayIndex, 3) = Text4.Text
  468.     Combo1.ListIndex = Combo1.NewIndex
  469.     Combo2.ListIndex = Combo2.NewIndex
  470.     Combo3.ListIndex = Combo3.NewIndex
  471.     ShowButtons
  472.     Text1.SetFocus
  473. End Sub
  474.