Solved

Determing if a check box is checked in a list box

Posted on 2002-04-12
2
176 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
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 200 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now