Results 1 to 4 of 4

Thread: List box with checkboxes

  1. #1
    Guest

    Post

    I have made great use of the checkbox feature in the list in VB6, but I can't figure out how to tell which one is selected (has the blue background, can be moved w/ keyboard arrows). In a regular listbox it used the .selected property. Now that is whether the item is checked true or false. Can I have my cake and eat it too?

  2. #2
    Lively Member
    Join Date
    Dec 1999
    Posts
    106

    Post

    the .listindex property will tell you which one is selected (zero based). -1 means no item is selected.

  3. #3
    Guest

    Post

    Many thanks!

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    If you mean want to find out how many items are checked then take a look at the Selected property:
    Code:
        Dim i As Integer
        Dim strItems As String
        
        For i = 0 To List1.ListCount - 1
            If List1.Selected(i) = True Then
                strItems = strItems & List1.List(i) & vbCrLf
            End If
        Next
        MsgBox strItems
    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


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