CheckedListBox Control in VB.NET


CheckedListBox is a ListBox with Checkbox to the left side of each item in the list. It is derived from ListBox so it provides all the functionality of ListBox Control.

Properties of CheckedListBox Control in VB.NET



Property Purpose

CheckOnClick

It is used to specify weather CheckBox should be toggled (change state) or not when an item is selected in the CheckedListBox. It has Boolean value. Default value is False.

MultiColumn

It is used to specify weather CheckedListBox supports multiple columns or not. It has Boolean value. Default value is false.

ColumnWidth

It is used to specify width of each column in MultiColumn CheckedListBox.

Items

It represents collection of items contained in CheckedListBox control.

Sorted

It is used to specify weather items of CheckedListBox are sorted in alphabetical order or not. It has Boolean value. Default value is false.

SelectionMode

It is used to get or set SelectionMode of CheckedListBox. It determines how user can select the Items of CheckedListBox. It can have one of the following four options:
(1) None: No Selection is allowed
(2) One: User can select only one item at a time.
(3) MultiSimple: User can select or deselect item just by mouse click or pressing spacebar.
(4) MultiExtended: User can select or deselect items by holding Ctrl key and mouse click. User can also select or deselect items by pressing Shift key and mouse click or arrow key. 
Default value is One. 

     

ScrollAlwaysVisible

It is used to specify weather Scroll Bars is always associated with CheckedListBox or Not regardless of number of items present in CheckedListBox. It has Boolean value. Default value is false.

HorizontalExtent

It is used to get or set width in pixel, by which a CheckedListBox can scrolled horizontally. It works only when Horizontal Scrollbar Property is set to true. 

HorizontalScrollbar

It is used to specify weather CheckedListBox can have Horizontal Scroll Bar or Not, If Number of Items in CheckedListBox are not accommodate in specified width. It has Boolean value. Default value is False. 

ThreeDCheckBoxes

It is used to get or set value which determines CheckBox has Flat or Normal Button State. It has Boolean value. Default value is false. When it is true check box has flat button state.

SelectedIndex

It is used to get or set zero based index of the item currently selected in CheckedListBox.

SelectedItem

It is used to get or set item currently selected in CheckedListBox.

SelectedItems

It is used to get collection of multiple items currently selected in CheckedListBox.

CheckedItems

It is used to get collection of multiple items currently checked in CheckedListBox.

SelectedIndices

It is used to get collection of zero based indexes of all items currently selected in CheckedListBox.

CheckedIndices

It is used to get collection of zero based indexes of all items currently checked in CheckedListBox.

Enable

It is used to specify weather CheckedListBox Control is enabled or not at runtime. It has Boolean value. Default value is true.

Visible

It is used to specify weather CheckedListBox Control is visible or not at runtime. It has Boolean value. Default value is true.

TabStop

It is used to specify weather user can use TAB key to set focus on CheckedListBox Control or not. It has Boolean value. Default value is true.


Methods of CheckedListBox Control in VB.NET



Method Purpose

ClearSelected

It is used to unselect all the items that are currently selected in ListBox.

FindString

It is used to find first occurrences of an item in the ListBox that partially match with string specified as an argument. If an item is found than it returns zero based index of that item, otherwise it returns -1.  The search performed by this method is case insensitive.

FindStringExact

It is used to find first occurrences of an item in the ListBox that exactly match with string specified as an argument. If an item is found than it returns zero based index of that item, otherwise it returns -1.  The search performed by this method is case insensitive.

GetSelected

It is used to determine weather an item whose index is passed as an argument is selected or not. It returns Boolean value.

SetSelected

It is used to select or deselect an item whose index is passed as an argument.
Example:
ListBox1.SetSelected (1, true) will select second item of ListBox.

ClearSelected

It is used to unselect all items in CheckedListBox.

GetItemChecked

It is used to check weather an item whose index is passed as an argument is checked or not. It returns Boolean value.

GetItemCheckState

It is used to get check state of an item whose index is passed as an argument. It returns 1 if item is checked otherwise false.

SetItemCheckState

It is used to set the check state of an item whose index is passed as an argument.
Example:
CheckedListBox1.SetItemChecked (1, CheckState.Checked
) will check the second item of CheckedListBox.


Events of CheckedListBox Control in VB.NET



Event Purpose

SelectedIndexChanged

It is the default event of ListBox Control. It fires each time a selected Item in the ListBox is changed.

ItemCheck

It fires each time an item is checked or unchecked.


Download Projects


Download Programs