?
Solved

Auto scrolling in a list box

Posted on 2001-06-05
2
Medium Priority
?
159 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:peteyhiggins
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 6156557
If you set the .TopIndex = .ListIndex for the list box then the selected row should be shown at the top of the list.
0
 
LVL 3

Expert Comment

by:nigelrowe
ID: 6156647
Yep, just put that code in the Click event of the list box
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question