IN VB6 I am populating a listbox via code. Vertical scroll bar appears after the box is filled. How do I, in code, keep the bottom entry, the last entry in view at the bottom of the lisbox. Now I have to manually scroll down.
Thanks
Printable View
IN VB6 I am populating a listbox via code. Vertical scroll bar appears after the box is filled. How do I, in code, keep the bottom entry, the last entry in view at the bottom of the lisbox. Now I have to manually scroll down.
Thanks
When needed: List1.ListIndex = List1.ListCount-1
Until you have added 1 item more than what can be viewed in the view area the last item added will not appear at the bottom because the vertical scrollbar is not yet visible so each item is displayed one under the previous then once you add the the item that exceeds the view area the last item entered will be visible at the bottom of the listbox by keeping the scrollbar at the bottom using the line LaVolpe posted
If you prefer not to select the newest item while populating the ListBox (and therefore avoid code in the ListBox's Click event from firing prematurely), the following alternate way achieves the same effect:
Code:List1.TopIndex = List1.NewIndex
Don't forget to mark this thread :check: Resolved!