|
|
Title | Set or clear all check boxes in a CheckedListBox in Visual Basic .NET |
Description | This example shows how to set or clear all check boxes in a CheckedListBox in Visual Basic .NET |
Keywords | CheckedListBox, set check boxes, clear check boxes, VB.NET |
Categories | Controls |
|
|
Strangely the CheckedListBox control doesn't provide an easy way to uncheck (or check) all of its items. Fortunately it's not hard to write a routine to do it.
The following code loops through all of the items in the CheckedListBox and uses the control's SetItemChecked method to make the item checked or not checked.
|
|
Private Sub SetChecked(ByVal clb As CheckedListBox, ByVal _
check_items As Boolean)
For i As Integer = 0 To clb.Items.Count - 1
clb.SetItemChecked(i, check_items)
Next i
End Sub
|
|
|
|
|
|