PDA

Click to See Complete Forum and Search --> : List box with checkboxes


Dec 15th, 1999, 09:00 AM
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?

hayessj
Dec 15th, 1999, 03:16 PM
the .listindex property will tell you which one is selected (zero based). -1 means no item is selected.

Dec 16th, 1999, 08:46 AM
Many thanks!

Serge
Dec 16th, 1999, 05:37 PM
If you mean want to find out how many items are checked then take a look at the Selected property:

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
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)