Solved

Determing if a check box is checked in a list box

Posted on 2002-04-12
2
179 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 70

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 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…

770 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