home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l405 / 1.ddi / LISTBOX.FR_ / LISTBOX.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  4.0 KB  |  122 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. Sub cmdAdd_Click ()
  86.     lstClient.AddItem txtName.Text              ' Add client name to list box.
  87.     txtName.Text = ""                           ' Clear text box.
  88.     txtName.SetFocus                            ' Place focus back in text box.
  89.     lblDisplay.Caption = lstClient.ListCount    ' Display number of entries in list.
  90. End Sub
  91. Sub cmdClear_Click ()
  92.     lstClient.Clear                             ' Empty list.
  93.     cmdRemove.Enabled = False                   ' Disable Remove button.
  94.     lblDisplay.Caption = lstClient.ListCount    ' Display number of items in list.
  95. End Sub
  96. Sub cmdClose_Click ()
  97.    Unload Me    ' Unload this form.
  98. End Sub
  99. Sub cmdRemove_Click ()
  100. Dim Ind As Integer
  101.     Ind = lstClient.ListIndex                       ' Get index.
  102.     If Ind >= 0 Then                                ' Make sure list item is selected.
  103.         lstClient.RemoveItem Ind                    ' Remove it from list box.
  104.         lblDisplay.Caption = lstClient.ListCount    ' Display number of items in list.
  105.     Else
  106.         Beep    ' Should never occur, because Remove is always disabled if no entry is selected.
  107.     End If
  108.     ' Disable button if no entries selected in list.
  109.     cmdRemove.Enabled = (lstClient.ListIndex <> -1)
  110. End Sub
  111. Sub lstClient_Click ()
  112.     cmdRemove.Enabled = (lstClient.ListIndex <> -1)
  113. End Sub
  114. Sub lstClient_DblClick ()
  115.     ' Press Remove button
  116.     cmdRemove.Value = True
  117. End Sub
  118. Sub txtName_Change ()
  119. ' Enable Add button if at least one character in name
  120.     cmdAdd.Enabled = (Len(txtName.Text) > 0)
  121. End Sub
  122.