VB.NET CheckBox Control

The CheckBox control is a control that allows the user to select or deselect options from the available options. When a checkbox is selected, a tick or checkmark will appear on the Windows form.

Let's create a CheckBox control in the VB.NET Windows form using the following steps.

Step 1: We need to drag the CheckBox control from the toolbox and drop it to the Windows form, as shown below.

VB.NET CheckBox Control

Step 2: Once the CheckBox is added to the form, we can set various properties of the checkbox by clicking on the CheckBox control.

CheckBox Properties

There are some properties of the VB.NET CheckBox control.

PropertyDescription
DefaultIt is used to get the default size of the checkbox.
AutoCheckThe AutoCheck property is used to check whether the checked value or appearance of control can be automatically changed when the user clicked on the CheckBox control.
CheckAlignIt is used to set the checkmark's alignment, such as horizontal or vertical on the checkbox.
AppearanceThe Appearance property is used to display the appearance of a checkbox control by setting a value.
CheckStateThe CheckState property is used to verify whether the checkbox status is checked in the window form.
ThreeStateThe ThreeState property is used to check whether the control allows one to set three check positions instead of two by setting values.
FlatStyleIt is used to obtain or set the flat appearance of a checkbox.

CheckBox Methods

There are some Methods of the VB.NET CheckBox control.

MethodDescription
OnClickThe OnClick method is used to fetch the Click event in the CheckBox control.
OnCheckStateChangedIt is used to call the CheckStateChanged event in the CheckBox control.
ToStringThe ToString method is used to return the current string of the CheckBox control.
OnCheckedChangedWhen the Checked property is changed in the CheckBox control, the OnCheckedChanged events occur.
OnMouseUpIt is used when it receives the OnMouseUp event in the CheckBox control.

CheckBox Events

There are some Events of the VB.NET CheckBox control.

EventDescription
CheckedChangedThe CheckedChanged event is found when the value of the checked property is changed to CheckBox.
DoubleClickIt occurs when the user performs a double click on the CheckBox control.
CheckStateChangedIt occurs when the value of the CheckState property changes to the CheckBox control.
AppearanceChangedIt occurs when the property of the Appearance is changed to the CheckBox control.

Let's create a program to understand the uses of CheckBox control in the VB.NET form.

Checkbx.vb

Output:

VB.NET CheckBox Control

Now select the fruit name by clicking on the items.

VB.NET CheckBox Control

Now click on the Submit button, it displays the following output on your screen.

VB.NET CheckBox Control