-
November 21st, 2017, 01:55 PM
#1
Getting ListBoxes to scroll in unison
In my VB5 program, ListBox A and ListBox B alongside it contain the same number of items, and it's too many to fit on the screen, so they both have a vertical scrollbar.
Actually, I hide B's scrollbar behind A, so only A's scrollbar is visible.
I want ListBox B to move in lockstep with ListBox A. And it does, just fine, when I use either A's scrollbar or the Up and Down keys on the keyboard. The "_Scroll" event does it for me as follows:
Code:
Private Sub lstA_Scroll()
lstB.TopIndex = lstA.TopIndex
End Sub
But ListBox A can also be scrolled by means of the wheel on the mouse, and I can't get B to scroll along with that. The best I can do is to use MouseMove as follows:
Code:
Private Sub lstA_MouseMove()
lstB.TopIndex = lstA.TopIndex
End Sub
The mouse wheel scrolls ListBox A alone, and then B twitches into place when the mouse moves. I would prefer they move in unison.
Other kinds of controls have a "_Change" event available, but evidently a ListBox does not. Is there some way I can get B to scroll when the mouse wheel scrolls A?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|