Private Sub cboPlayers_Click()
lstPlayers.ListIndex = cboPlayers.ListIndex
End Sub
Private Sub cmdAdd_Click()
Dim intI As Integer
For intI = 0 To lstPlayers.ListCount -
1
cboPlayers.List(intI) = lstPlayers.List(intI)
Next intI
End Sub
Private Sub Form_Load()
lstPlayers.AddItem "Mark Waugh"
lstPlayers.AddItem "Ricky Ponting"
lstPlayers.AddItem "Sachin Tendulkar"
lstPlayers.AddItem "Shane Bond"
End Sub
The list box (lstNames) contains the names of some
great cricket players. When a user clicks the cmdAdd
button, the values in the list box are also added
to the combo box (cboPlayers). Initially the Combo
box is empty.
When a user selects a name in the combo box, the
name is also selected in the list box.
|
|
In this chapter, you were introduced
to the list & the combo box controls. The
list controls come in several varieties. These
controls are also called multivalue controls.
|
|