Discussion Locked

Scroll custom event in VB.Net

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am using VB.Net and want to create a custom event. I have two list boxes, of the same size, that when I scroll one of them, I would like the other listbox to scroll too. In VB 6, there was a scoll event. Now in .Net, the SelectedIndexChanged event is the replacement, but requires the user to click inside of the list box. I would like it to change when the user clicks the vertical scroll bar. I believe that a custom event, "ScrollChanged", would be a solution, but I do not know how to create it. Anyone know how to help please respond. Thank you.

1 reply

by bckurd

Yes .Net doesn't have scrolling event for list boxes. However there is a way to do that. First do not define vertical scrolling for the list boxes for both of them. Add another scrolling object (vertical one) on to your form. You will be able to control the scrolling event for the scrollbar.

Whenever the value of scroll changes, you can carry the index of list box to top. So you will be listing the items in the list box with playing its index in the list. The both list boxes can act same at same time.

I hope that helps!
Bedri.

This discussion is closed to new replies.