tags:

views:

334

answers:

1

I'm working on a winform app and am interating through a checkboxlist to see what's checked. If it's checked, i need to know what it's value member or value property is because I assigned it when I bound the checkbox list.

How can I get that?

Here's what I have now:

             for (int i = 0; i < clbIncludes.Items.Count; i++)

                if (clbIncludes.GetItemCheckState(i) == CheckState.Checked)
                {
                    //need the values of the checked checkbox here
                }");
+2  A: 
foreach(object itemChecked in checkedListBox1.CheckedItems)
{
    MyItem item = itemChecked as MyItem;

    if (item != null)
    {
       // use item...
    } 
}

MSDN Ref.

Mitch Wheat