I have a CheckedListBox where I want an event after an item is checked so that I can use CheckedItems with the new state.
Since ItemChecked is fired before
Don't know if this applies but I wanted to use a checklistbox to filter results. So as the user checked and unchecked items I wanted the list to show\hide items.
I was having some issues which led me to this post. Just wanted to share how I did it without anything special.
Note: I have CheckOnClick = true but it would probably still work without
The event I use is "SelectedIndexChanged"
the enumeration I use is ".CheckedItems"
This give the results I think we may expect. So simplified it comes down to ....
private void clb1_SelectedIndexChanged(object sender, EventArgs e)
{
// This just spits out what is selected for testing
foreach (string strChoice in clb1.CheckedItems)
{
listBox1.Items.Add(strChoice);
}
//Something more like what I'm actually doing
foreach (object myRecord in myRecords)
{
if (clb1.CheckItems.Contains(myRecord["fieldname"])
{
//Display this record
}
}
}