home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk1 / listbox.fr_ / listbox.bin
Text File  |  1993-04-28  |  4KB  |  132 lines

  1. VERSION 2.00
  2. Begin Form frmListBox 
  3.    Caption         =   "List Box Example"
  4.    Height          =   5730
  5.    Left            =   1170
  6.    LinkTopic       =   "Form1"
  7.    ScaleHeight     =   5325
  8.    ScaleWidth      =   5625
  9.    Top             =   1320
  10.    Width           =   5745
  11.    Begin CommandButton cmdClose 
  12.       Caption         =   "&Close"
  13.       Height          =   495
  14.       Left            =   3840
  15.       TabIndex        =   8
  16.       Top             =   3840
  17.       Width           =   1215
  18.    End
  19.    Begin CommandButton cmdClear 
  20.       Caption         =   "C&lear"
  21.       Height          =   495
  22.       Left            =   3840
  23.       TabIndex        =   7
  24.       Top             =   2520
  25.       Width           =   1215
  26.    End
  27.    Begin CommandButton cmdRemove 
  28.       Caption         =   "&Remove"
  29.       Enabled         =   0   'False
  30.       Height          =   495
  31.       Left            =   3840
  32.       TabIndex        =   6
  33.       Top             =   1680
  34.       Width           =   1215
  35.    End
  36.    Begin CommandButton cmdAdd 
  37.       Caption         =   "&Add"
  38.       Default         =   -1  'True
  39.       Enabled         =   0   'False
  40.       Height          =   495
  41.       Left            =   3840
  42.       TabIndex        =   5
  43.       Top             =   840
  44.       Width           =   1215
  45.    End
  46.    Begin ListBox lstClient 
  47.       Height          =   2760
  48.       Left            =   600
  49.       Sorted          =   -1  'True
  50.       TabIndex        =   1
  51.       Top             =   1440
  52.       Width           =   2655
  53.    End
  54.    Begin TextBox txtName 
  55.       Height          =   375
  56.       Left            =   600
  57.       TabIndex        =   0
  58.       Top             =   720
  59.       Width           =   2655
  60.    End
  61.    Begin Label lblDisplay 
  62.       BorderStyle     =   1  'Fixed Single
  63.       Height          =   375
  64.       Left            =   2400
  65.       TabIndex        =   4
  66.       Top             =   4440
  67.       Width           =   855
  68.    End
  69.    Begin Label lblClients 
  70.       Caption         =   "# Clients"
  71.       Height          =   255
  72.       Left            =   600
  73.       TabIndex        =   3
  74.       Top             =   4440
  75.       Width           =   855
  76.    End
  77.    Begin Label lblName 
  78.       Caption         =   "&Name to add"
  79.       Height          =   255
  80.       Left            =   600
  81.       TabIndex        =   2
  82.       Top             =   360
  83.       Width           =   1215
  84.    End
  85. End
  86.  
  87. Sub cmdAdd_Click ()
  88.     lstClient.AddItem txtName.Text              ' Add client name to list box.
  89.     txtName.Text = ""                           ' Clear text box.
  90.     txtName.SetFocus                            ' Place focus back in text box.
  91.     lblDisplay.Caption = lstClient.ListCount    ' Display number of entries in list.
  92. End Sub
  93.  
  94. Sub cmdClear_Click ()
  95.     lstClient.Clear                             ' Empty list.
  96.     cmdRemove.Enabled = False                   ' Disable Remove button.
  97.     lblDisplay.Caption = lstClient.ListCount    ' Display number of items in list.
  98. End Sub
  99.  
  100. Sub cmdClose_Click ()
  101.    Unload Me    ' Unload this form.
  102. End Sub
  103.  
  104. Sub cmdRemove_Click ()
  105. Dim Ind As Integer
  106.     Ind = lstClient.ListIndex                       ' Get index.
  107.     If Ind >= 0 Then                                ' Make sure list item is selected.
  108.         lstClient.RemoveItem Ind                    ' Remove it from list box.
  109.         lblDisplay.Caption = lstClient.ListCount    ' Display number of items in list.
  110.     Else
  111.         Beep    ' Should never occur, because Remove is always disabled if no entry is selected.
  112.     End If
  113.  
  114.     ' Disable button if no entries selected in list.
  115.     cmdRemove.Enabled = (lstClient.ListIndex <> -1)
  116. End Sub
  117.  
  118. Sub lstClient_Click ()
  119.     cmdRemove.Enabled = (lstClient.ListIndex <> -1)
  120. End Sub
  121.  
  122. Sub lstClient_DblClick ()
  123.     ' Press Remove button
  124.     cmdRemove.Value = True
  125. End Sub
  126.  
  127. Sub txtName_Change ()
  128. ' Enable Add button if at least one character in name
  129.     cmdAdd.Enabled = (Len(txtName.Text) > 0)
  130. End Sub
  131.  
  132.