Solved

ListBox Question

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 ListBox Question 4 55
Automatic Email Reminder 4 70
Error with a code discussed on this page 5 38
add criteria to query in VB, Access 2003 2 29
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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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