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
 
Back
Top