Solved

Auto scrolling in a list box

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 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

16 Experts available now in Live!

Get 1:1 Help Now