Visual Basic - Objects - Controls - ListBox
downx.gif (830 bytes)Propertiesdownx.gif (830 bytes)Methodsdownx.gif (830 bytes)Events

VB 4 : ListBox.gif (963 bytes)

ListBox - Properties: ListCount, Sorted

ListCount
number of items in list
Sorted
= True|False
Set at design-time, cannot be changed while the program is running.

ListBox - Methods: AddItem, RemoveItem

AddItem
Add text$ in specific position i:
List1.AddItem text$, i
 
Add text$ to end of list - or in proper alphabetical position if Sorted=True:
List1.AddItem text$
 
A TextBox may be used to add items to a ListBox:
Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then '<Enter>
    List1.AddItem Text1.Text
    Text1.Text = ""
  End If
End Sub

ListBox - Events: