Check all checkboxes in checkboxlist with one click using c#

Brenelyn picture Brenelyn · Dec 27, 2012 · Viewed 77.6k times · Source

I want to have a button that once clicked, it will select all checkboxes in my checklistbox. I've search the possible answers but I always see examples for asp.net and javascript. I am using Windows form in c#. Thank you for any response.

Answer

SekaiCode picture SekaiCode · Dec 27, 2012
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
    checkedListBox1.SetItemChecked(i, true);
}