How to disable a checkbox in a checkedlistbox?

后端 未结 11 737
遥遥无期
遥遥无期 2020-12-03 10:46

I have some items in a CheckedListBox, I want to disable the CheckBox of first item in it.
i.e. I want to disable the first item in the C

11条回答
  •  执笔经年
    2020-12-03 11:05

    The solution is to use the event ItemChecking:

    _myCheckedListBox.ItemChecking += (s, e) => e.Cancel = true;
    

    This will cancel all the checking on every item, but you can always do more refined solution but testing the current .SelectedItem

提交回复
热议问题