Using a CheckBox control in Visual Basic 6.0

A checkbox control is rather similar to an option button. The value property of both the controls is tested to check the current state.Check boxes are not mutually exclusive. A check box is a control that allows the user to set or change the value of an item as true or false. The control appears as a small square . When this empty square is clicked, it gets marked by a check symbol . These two states control the checkbox as checked or unchecked . the CheckBoxList control is a single control that acts as a parent control for a collection of check-box list items.When a check box appears in a group with other similar controls, it assumes a completely independent behavior and it must be implemented as its own entity. This means that clicking a check box has no influence on the other controls.


1.Open Visual Basic 6.0 and create a new Standard EXE Project.

2.From Standard EXE project Dialogbox choose Standard EXE form.

2. Add one  checkbox  from toolbox on the form.







3. Double click on Checkbox to open code window and type the following code

Private Sub Check1_Click()

If Check1.Value = 1 Then

MsgBox “red”


MsgBox “blue”

End If

End Sub







4. press F5 to run







5.when you select the checkbox output is:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>