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 javascri
After arriving at this question multiple times, I have decided I will solve it for myself once and for all, with an extension method.
public static class Extensions
{
public static void CheckAll(this CheckedListBox checkedListBox, bool check)
{
for (int i = 0; i < checkedListBox.Items.Count; i++)
checkedListBox.SetItemChecked(i, check);
}
}
MyCheckedListBox.CheckAll(true);