Checked ListBox ClearSelected() not working

0
0

I have 3.2.20 running but the CheckedListbox doesn’t clear with ClearSelected() an not with chkListbox.Update()..
I now have this as a workaround:

for (int x = 0; x < mRoles.Count; x++)
{
lstRoles.SetItemChecked(x, false);
}

 

  • You must to post comments
0
0

Ouch !! I misunderstood the ClearSelected, my wrong.. 🙂

  • You must to post comments
0
0

ListBox.ClearSelected() is the same as ListBox.SelectedIndex = -1. It removes the selected item, not the checked ones. The CheckedListBox can have 1 selected item and multiple checked items.

To uncheck all items you need to call SetItemChecked(), as you already did. Consider that an app may override the state of an item processing OnItemCheck and changing the state.

 

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.