Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically check an item in a CheckedListBox in C#?

I have a CheckedListBox, and I want to automatically tick one of the items in it.

The CheckedItems collection doesn't allow you to add things to it.

Any suggestions?

like image 653
Andrew Ducker Avatar asked Dec 16 '08 09:12

Andrew Ducker


1 Answers

You need to call SetItemChecked with the relevant item.

The documentation for CheckedListBox.ObjectCollection has an example which checks every other item in a collection.

like image 188
Jon Skeet Avatar answered Sep 26 '22 04:09

Jon Skeet