Hello,
I want to know how to set the Vertical Scroll Bar to
certain positions in a List Box through code.
Any help would be greatly appreciated.
Thank you,
Jeff
I wanted to show a simple way to reset the scroll bar back to the top and
show the first item of the listbox:
Me!List2 = Me!List2.ItemData(0)
Me!List2 = Null
What this code does is set the value of the listbox to the very first
line which causes the listbox to scroll up to the top. Then you set the
value to null to clear out any selection. All this is done without
changing the focus on the form! (important for my application)
I was using the selection in one listbox to set the rowsource of a second
listbox. I did not want the focus to be taken away from the first listbox
because the item that was selected in the first listbox would not be
indicated. It was driving me crazy trying to figure out how to reset the
second listbox without changing the focus. Every time the user was
selecting a new value in the first listbox the second listbox would stay
selected to the last value that was picked, and sometimes it would be
scrolled way down near the bottom of the list, which was confusing for my
users.
This method seemed to solve my problem. I hope that this tip saves
people from the frustration I experienced.
-Wapeka