Auto scrolling in a list box
Posted on 2001-06-05
I have a list box that stores a list of user names. The form gives the option of viewing the names either by the NT Logon name (ie PHIGGINS) or by Last Name, First Name (ie Higgins, Peter).
I've got code that switches between them fine and the same user remains selected. The problem I'm having is that the list box doesn't scroll to show the name, so the user can't see that it is selected. For instance, if the first 20 names are shown in the list box and one is selected and then the display is changed, because the listbox is sorted, that name may be the 50th in the list, but the listbox still only shows the first 20 and the user has to scroll down to see the selected name.
Is there any way to make a listbox automatically scroll to show a selected entry?