Solved

LISTBOX control

Posted on 1998-12-31
5
155 Views
Last Modified: 2010-05-03
I know is this probably a stupid question, I found a property on the listbox control that allows the items to be checked.  However, I cannot find any way to reference the item if it is checked.  What is the wat to do this?  For example this is what I want to do:

for i =0 to list1.listcount-1
if list1.list(i).value=true then
msgbox(list1.list(i)
end if
next

However, It seems it will not work.  I am setting up a timer event, I want the user to be able to check mutiple hours for the timer to be executed, and I don't want to put 24 checkbox buttons on the form.

Thanks
0
Comment
Question by:windows1
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1453429
for the listbox control, there is a property called "Selected". i think that is what you are lookig for.

vmano
0
 
LVL 3

Accepted Solution

by:
jbil earned 100 total points
ID: 1453430
Dim i
For i = 0 To List1.ListCount - 1
    If List1.Selected(i) = True Then
     MsgBox (List1.List(i))
    End If
Next
0
 

Author Comment

by:windows1
ID: 1453431
Thank you so much!  Also, The listbox is forcing the horizontal scrollbar even thought they all the times fit, it forces a scroll bar and duplicates the last column.   For instances I have a columnt 6 am to noon and a 2nd column from 1 to 6, the one to six is listed 2 times it forces a scroll bar. is there a way to remove this?

thanks
0
 
LVL 3

Expert Comment

by:vmano
ID: 1453432
i don't see how my comment is different from jbil's answer. anyway, i will let jbil answer your next question also.

vmano
0
 
LVL 3

Expert Comment

by:jbil
ID: 1453433
Scrollbar depends on size of listbox and size of font.
list width has to be wide enough to stop scrollbar.
one way is in design mode fill (list) with num of entries, in your case 12 then stretch the list until it lines up the way you want with no scroll bars. then you can delete the list and add the real list now or at run time.

Thanks for the points
 
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

786 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