CheckedListBox in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the CheckedListBox control


This control displays a series of items with check boxes in a list format, which enables the user to pick and choose similar items from a list of choices.

Please notice that you could use a ListBox for the same task, but there are some differences between these two controls:

1. In a CheckedListBox, previously checked items remain checked when the user clicks another item, while if the user clicks an item in a ListBox, the previously selected items get deselected. Though you can use the Shift and Ctrl keys to change this behavior, making complex selections is tricky.

2. The user must click each CheckedListBox item individually to select it, while ListBox allows simple or extended selection which means, for example, the user could Shift+click to select all of the items in a range. Meaning if you are likely to want that type of selection, consider using a ListBox instead of a CheckedListBox.

When the CheckedListBox is not big enough to display all of the items at once, it displays a vertical scrollbar as you can see all the items.
Also if some of the items are too wide to fit, you should set the control's HorizontalScrollBar property to True in order to display a horizontal scrollbar.

To displays items in multiple columns, you set the MultiColumn property to True.

By default, you must click an item and then click its box to check the item. To be able to select an item with a single click, set the control's CheckOnClick property to True.

To display the CheckedListBox's items in sorted order, set the control's Sorted property to True.

This is an example of CheckedListBox control populated with list of states and territories of the United States.


Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.