CheckedListBox-- item checkmark status?

  • Thread starter Thread starter Dave Veeneman
  • Start date Start date
D

Dave Veeneman

Is there a simple way to check the status of an item as checked or unchecked
in a CheckedListBox?

I need to cycle through a CheckedListBox and take one of two actions for
each item, depending on whether the item is checked or unchecked. So the
CheckedItems property doesn't really help me. I expected something simple,
like checkedListBox1.SelectedItem.Checked, but I can't find any property
like that.

So, if I need to iterate through all of the items of a CheckedListBox and
determine whether each is checked or unchecked, how do I do it? Thanks.
 
I found it-- the list box has a GetItemChecked method that takes an index
and returns a bool. I don't know what drugs the Microsofties were doing when
they designed this control, but they must have been great!
 
Dave Veeneman said:
I don't know what drugs the Microsofties were
doing when they designed [CheckedListBox],
but they must have been great!

Agreed. Every other control would lead you to expect clb.Items[n].Checked;
and then there's the strange ItemCheck event where the item state *hasn't
actually changed yet* and you have to negate the value to use it.

P.
 
Back
Top