List box navigate with button

J

Jorge Barreto

I have a list box and a NEXT button. How can I do to navigate (to illuminate)
the registers when pressing the NEXT button.
 
J

John Welch

I'm not sure what you're asking, but if you want your button to change the
selection in a list box to the next item, you can use this code:

Private Sub cmdNext_Click()

lstMyListBox.SetFocus
If lstMyListBox.ListIndex = lstMyListBox.ListCount - 1 Then
lstMyListBox.ListIndex = 0
Else
lstMyListBox.ListIndex = lstMyListBox.ListIndex + 1
End If
End Sub
 
J

Jorge Barreto

John,
This solved my problem and learned very.
Thanks for your help.
Jorge Barreto


"Jorge Barreto" escreveu:
 
Top