?
Solved

LISTBOX control

Posted on 1998-12-31
5
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
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.
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…
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…
Suggested Courses

762 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