Checklist box code help needed

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have a check list box.When user selects a specific value '(All)' I want to
uncheck all other check boxes in the list. How can I achieve this in code?

Thanks

Regards
 
Tom,

If you detect that the all is checked than

remove the handler from the check event (or what you use)
than uncheck all boxes in a loop
check the all box again
add the handler again

And it is done,

If you want some sample code, than show at least the event that you are now
using.

I hope this helps,

Cor
 
John said:
Hi

I have a check list box.When user selects a specific value '(All)' I want to
uncheck all other check boxes in the list. How can I achieve this in code?

As it happens, I've just been doing something similar.

I'll assume your 'All' item is the top one (item 0).

Try this code:

If CheckedListBox1.GetItemChecked(0) = True Then
For i = 1 To CheckedListBox1.Items.Count - 1
CheckedListBox1.SetItemChecked(i, False)
Next i
End If
 
Thanks This worked. How can I make sure then when of the other options is
clicked then the All option is unticked?

Thanks again

Regards
 
Back
Top