Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckBoxList - How to select all 1

Status
Not open for further replies.

edpatterson

IS-IT--Management
Feb 24, 2005
186
How would I check all items in a checkboxlist?
Code:
For each <what> in checkboxlist.items
    ?
Next

Nothing I have tried works...

Thanks,
Ed
 
This should work.
Code:
Dim cblItem As Object
For each cblItem in checkboxlist.items
   cblItem.CheckState = True
End Each

-I hate Microsoft!
-Forever and always forward.
 
Sorry wrong object (I was thinking of something else) for that to work on. You can't do a for each it should be:

Code:
Dim cblIndex as Integer
For cblIndex = 0 To CheckedListBox1 - 1
   CheckedListBox1.SetItemChecked(cblIndex, True)
Next

-I hate Microsoft!
-Forever and always forward.
 
Thanks! I poked around in the object looking for the correct method. You must admit is not very intuitive. I was looking for something like checkedlistbox.items.item(int).checked = true

Ed
 
Yeah, I did the same thing before. You think it should work like most other item collections, but it doesn't. That is Microsoft for you.

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top