Here's an example. In this example lstTest is the list box and cmdUp and
cmdDown are command buttons. Remember, though, that the user can scroll
through the items in a list box using the up and down arrow keys, so I
can't, off-hand, think of many scenarios in which this code would be very
useful.
Private Sub cmdDown_Click()
If Me.lstTest.ListIndex < Me.lstTest.ListCount - 1 Then
Me.lstTest = Me.lstTest.ItemData(Me.lstTest.ListIndex + 1)
Else
Me.lstTest = Me.lstTest.ItemData(0)
End If
End Sub
Private Sub cmdUp_Click()
If Me.lstTest.ListIndex > 0 Then
Me.lstTest = Me.lstTest.ItemData(Me.lstTest.ListIndex - 1)
Else
Me.lstTest = Me.lstTest.ItemData(Me.lstTest.ListCount - 1)
End If
End Sub