Reputation: 4943
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
}");
Upvotes: 1
Views: 1625
Reputation: 300559
foreach(object itemChecked in checkedListBox1.CheckedItems)
{
MyItem item = itemChecked as MyItem;
if (item != null)
{
// use item...
}
}
MSDN Ref.
Upvotes: 2