Results 1 to 2 of 2

Thread: CheckBoxes in Listboxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Boise, ID, USA
    Posts
    5

    Post

    I'm very GREEN at this. I work with databases, but not coding. I'm learning Visual Basic on the fly using the VB6 Learning Edition.

    I can't find any info anywhere on how to code this thing. I've managed to created a listbox with checkboxes. Now I want to be able to collect the checked check boxes and store it for the next step of a query where the checked items narrow down the items the user can list.

    There is about 7 groups to choose from, and I have tried to make them in a hieracrchy situation. The first listbox selection will determine what is seen in the next listbox. Should be easy, ya think? But I haven't seen any code using this sort of thing to compare to. Can anyone help?

    Thanks!

    Mary )


    ------------------
    Rule #1: Don't Sweat Small Stuff
    Rule #2: EVERYTHING is Small Stuff

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124

    Post

    This code will loop through all the items in the list. The if statement checks to see if the item was checked:
    Code:
        Dim i As Long
        
        For i = 0 To List1.ListCount - 1
            If List1.Selected(i) = True Then
                ' Code to execute if list item checked
            End If
        Next i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width