programmatically check/uncheck all items in the checklistbox control

  • Thread starter Thread starter Mike Kim
  • Start date Start date
M

Mike Kim

hi all,

i have a checklistbox populated with about 50 items from database. and on
the same form, i added to button to do the following.
[Check All] if you click this button, i want to have all items in the
checklistbox to be checked
[Uncheck All] i want to have all items in the checklistbox to be unchecked.

thanks advance, folks.
 
Hi Mike,

Create a button called 'checkall'. Then in the click event, this code:
Dim i As Integer

For i = 0 To CheckedListBox1.Items.Count - 1

CheckedListBox1.SetItemChecked(i, True)

Next

Of course, the code simply need be changed to 'false' to reverse the
process.

HTH,

Bernie Yaeger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top