Solved

LISTBOX control

Posted on 1998-12-31
5
156 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

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
how to open Waze.com/livemap from address saved in DB? 26 211
Validating VB6 Function 19 65
Microsoft Access combo box help 2 50
Added a column screws up code 5 63
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…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

828 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