[RESOLVED] Auto scroll to bottom of Combobox?
I have a form with a combobox which is populated at form load. The vertical scrollbar which appears when the list is too long to show all items is showing the topmost (earliest added items) and the latest added items have to be scrolled to see them.
Is there an easy way to have the combobox scrollbar automatically scroll to its fullest on form load so that the latest entries (bottom of the list) will be visible in the combobox? :confused:
Re: Auto scroll to bottom of Combobox?
Default behavior is that the combobox scroll's to show the selected item.
If you wish to modify the height of the dropdown box, look at this thread
If you still wish to scroll to the bottom you have two choices
1) Set the ListIndex = ListCount-1, but that will change the user's selection and not user-friendly
2) In the combo's DropDown event, locate the actual dropdown window via FindWindow API (a separate window and is not the combobox hWnd). Then send it a WM_VScroll message with the SB_Bottom flag to force scroll bar to bottom.
Edited: Another option is to add your combobox items in reverse order, newest at the top?
Re: Auto scroll to bottom of Combobox?
I set the ListIndex to ListCount-1.
It works for me in my case because I have added it just before the program adds some text to the text window of the combobox before the user has input. So the user sees the list scrolled to the bottom.
Thanks LaVolpe