Solved

ListBox Question

Posted on 1998-08-18
2
171 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access query that references subform 5 47
Recommendation vb6 to vb.net or others 14 174
TT Auto Dashboard 13 95
VBA: copy range dynamically based on config sheet v2 3 48
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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…

840 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