Search code examples
c#winformsbuttoncheckboxchecklistbox

Check all checkboxes in checkboxlist with one click using c#


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.


Solution

  • for (int i = 0; i < checkedListBox1.Items.Count; i++)
    {
        checkedListBox1.SetItemChecked(i, true);
    }