Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSet or clear all check boxes in a CheckedListBox in Visual Basic .NET
DescriptionThis example shows how to set or clear all check boxes in a CheckedListBox in Visual Basic .NET
KeywordsCheckedListBox, set check boxes, clear check boxes, VB.NET
CategoriesControls
 
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
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated