Home » VB.NET CheckBox Control

VB.NET CheckBox Control

by Online Tutorials Library

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.

Property Description
Default It is used to get the default size of the checkbox.
AutoCheck The 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.
CheckAlign It is used to set the checkmark’s alignment, such as horizontal or vertical on the checkbox.
Appearance The Appearance property is used to display the appearance of a checkbox control by setting a value.
CheckState The CheckState property is used to verify whether the checkbox status is checked in the window form.
ThreeState The ThreeState property is used to check whether the control allows one to set three check positions instead of two by setting values.
FlatStyle It is used to obtain or set the flat appearance of a checkbox.

CheckBox Methods

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

Method Description
OnClick The OnClick method is used to fetch the Click event in the CheckBox control.
OnCheckStateChanged It is used to call the CheckStateChanged event in the CheckBox control.
ToString The ToString method is used to return the current string of the CheckBox control.
OnCheckedChanged When the Checked property is changed in the CheckBox control, the OnCheckedChanged events occur.
OnMouseUp It is used when it receives the OnMouseUp event in the CheckBox control.

CheckBox Events

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

Event Description
CheckedChanged The CheckedChanged event is found when the value of the checked property is changed to CheckBox.
DoubleClick It occurs when the user performs a double click on the CheckBox control.
CheckStateChanged It occurs when the value of the CheckState property changes to the CheckBox control.
AppearanceChanged It 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


Next TopicPictureBox Control

You may also like