CheckedListBox-- item checkmark status?

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.
 
D

Dave Veeneman

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!
 
P

Paul E Collins

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.
 

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

Top