How can I get the listbox selection to change when the user scrolls down through the options? I am using VB5.
Printable View
How can I get the listbox selection to change when the user scrolls down through the options? I am using VB5.
I'm not exactly sure what you want to do, but if you use this code with a listbox that is 5 items high, the middle item will stay highlighted.
Code:Private Sub List1_Scroll()
If List1.TopIndex + 2 > List1.ListCount - 1 Then
List1.ListIndex = List1.ListCount - 1
Else
List1.ListIndex = List1.TopIndex + 2
End If
End Sub
I have a listbox. It has preset values. When my program runs, I scroll the list box. When I scroll it does not change the selected item. I want it to. I can find no reference to directional scrolling or I would add or delete to the .listindex based on whether or not they are sctrolling up or down. The .text value does not even change when it shows up different in the box.
Any help would be greatly appreciated.
Boothman