Home » VB.NET CheckedListBox Control

VB.NET CheckedListBox Control

by Online Tutorials Library

VB.NET CheckedListBox Control

The CheckedListBox is similar to Listbox except that it displays all items in the list with a checkbox that allows users to check or uncheck single or multiple items.

Let’s create a CheckedListBox control in the VB.NET Windows form using the following steps.

Step 1: Drag the CheckedListBox control from the Toolbox and drop it to the Windows form, as shown below.

VB.NET CheckedListBox Control

Step 2: Once the CheckedListBox is added to the Form, we can set various properties of the CheckedListbox by clicking on the CheckedListBox control.

CheckedListBox Properties

There are following properties of the CheckedListBox control.

Properties Description
AccessibilityObject It obtains a value that determines whether the AccessibilityObject is assigned to the CheckedListBox control.
AccessibleName It gets or sets a value that tells if the accessible client application has used the name of the checkedlistbox control.
AllowSelection It gets a value that indicates whether the ListBox allows for the item to be selected from the list.
AllowScollOffset It gets or sets a value representing whether the CheckedListBox control is scrolled in ScrollControlIntoView(Control).
BorderStyle It is used to set the type of border around the CheckedListBox by getting or setting a value.
CheckedItems It is used to store a collection of checked items in the CheckedListBox.
ScrollAlwaysVisible It is used to set or get a value that indicates if the vertical scroll bar appears in Windows Forms at all times.
SelectedItems It is used to get all selected items from CheckedListBox.
SelectionMode It is used to get or set a value representing the items’ selection mode in the CheckedListBox.
TopIndex It is used to set the first visible item at the top of the index in the CheckedListBox.

CheckedListBox Methods

Methods Description
ClearSelected() It is used to unselect all the selected items in the CheckedListBox.
CreateAccessibilityInstance() It is used to create new accessibility of the object in the CheckedListBox Control.
CreateItemCollection() It is used to create a new instance for the collected item in the list box.
DestroyHandle() It is used to destroy the handle associated with CheckedListBox.
Equals(Object) It is used to validate whether the specified object is equal to the current object in the CheckedListBox or not.
FindForm() It is used to obtain the form in which CheckedListBox has control.
GetItemText(Object) It is used to get the text of the specified item in the CheckedListBox.
GetType() It is used to get the current item type in the CheckedListBox.
Show() A Show() method is used to display the CheckedListBox Control to the user.
Sort() A Sort() method is used to sort or organize all the items available in CheckedListBox.

Furthermore, we can also refer to VB.NET Microsoft documentation to get a complete list of CheckedListBox properties and methods.

Let’s create a program to select or check more than one item from the CheckedListBox in the VB .NET form.

CheqListvb.vb

Output:

VB.NET CheckedListBox Control

In the above list, we can select more than one item from the CheckedListBox in Windows Form.

VB.NET CheckedListBox Control

After that, click on the Select button to display the selected item in Windows Form.

VB.NET CheckedListBox Control


You may also like