Solved

Auto scrolling in a list box

Posted on 2001-06-05
2
149 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 49
VB 6.0 printer how to align 6 57
Reading the Contents of a Directory In Access VBA 5 58
MS Access 03, TransferText, decimal places 8 37
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

932 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now