home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch05 / gradient / keycombo.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-20  |  14.7 KB  |  457 lines

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