?
Solved

Determing if a check box is checked in a list box

Posted on 2002-04-12
2
Medium Priority
?
185 Views
Last Modified: 2010-05-02
Hi,
I  have a list box using the checkbox style.
Is there a way to determine if a certain item in the list is checked? If not, what good is the checkbox ?

I am using the ItemCheck event when I click on an item to check or uncheck it, but I don't see how to determine if the item is checked or not.

Thanks

Jeff
0
Comment
Question by:jscharpf
[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 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 800 total points
ID: 6937684
use the Selected collection:

Option Explicit

Private Sub Command1_Click()
Dim intI As Integer

    For intI = 0 To List1.ListCount - 1
        If List1.Selected(intI) Then MsgBox List1.List(intI) & " is selected!"
    Next
End Sub

Private Sub Form_Load()
    With List1
        .AddItem "item 1"
        .AddItem "item 2"
        .AddItem "item 3"
        .AddItem "item 4"
        .AddItem "item 5"
    End With
End Sub
0
 

Author Comment

by:jscharpf
ID: 6937710
That's exactly what I needed!!
Thanks emoreau!!

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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

764 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