Solved

ListBox Question

Posted on 1998-08-18
2
168 Views
Last Modified: 2010-04-30
I need to be able to read the value from a listbox that is only one line high.  I want the user to be able to click the up/down scroll bar (so it only shows one line of the listbox at a time), but not have to worry about actually clicking the item.  
The value must then be passed to another control to be written to a recordset.
What procedure or event do I use?  I have tried List1. Scroll but that doesn't seem to work.  As yet, I can only seem to get it to work once the user clicks the actual item.  This isn't suitable for my project.

Any ideas anyone???????????

Thanks...
   
0
Comment
Question by:nu2vb
2 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 20 total points
ID: 1429521
put a listbox (list1) on a form, and run this code:

Option Explicit

Private Sub Form_Load()
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
    List1.AddItem List1.ListCount
   
End Sub

Private Sub List1_Scroll()
    List1.ListIndex = List1.TopIndex
End Sub


it works
0
 

Author Comment

by:nu2vb
ID: 1429522
Thanks Anthony.  I tried and just used List1.Text to check my response - Absolutely perfect!

Now I can proceed to the next problem!

Thanks again.
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
how to open Waze.com/livemap from address saved in DB? 26 177
SSRS expression Issue finding a string 10 66
VBA error replacing data 6 37
Using "ScreenUpdating" 6 55
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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

910 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

21 Experts available now in Live!

Get 1:1 Help Now