# Visual Basic 6 Controls

The visual basic 6 controls are objects that are placed on the form. Even a form is a control object. Each of the control objects has properties, methods, and events associated with them.

Learn visual basic 6 basics before you begin with vb controls.

Properties are attributes that describe the type of control. Methods are functions performed by the control object. A method is triggered due to some events such as mouse click, mouse over, key press and so on.

A list of visual basic common controls is given below.

1. Form
2. Command Button
3. Labels
4. Text box
5. Image control and Picture boxes
6. Frame controls
7. Option buttons
8. Check boxes

## Naming Conventions for Each Controls

You can name forms in many ways, but the more meaningful the name is, the better it is for others to read and understand your visual basic program.

The convention is to use 3 letter to describe the control and rest of the name for purpose of the control.

For example,

frmBankAccount
btnSubmit
btnReset
imgBaloon
chkMale
optNo

## Control Properties

Every control object have properties that uniquely describes that control. You can change the properties both in design view as well as in run time.

Some property values are necessary and global to all controls such as Name, Caption, Visible, etc. and some are very specific to a control, no other control can have that property.

For example,

A checkbox has a property called value – checked, unchecked, grayed. These are unique to check boxes.

Radio buttons have a property called value – true or false. These will check or uncheck the radio option and unique properties for radio buttons.

## Methods and Events

Visual basic methods and events are visible in a code editor. You can choose a control and then the event for the control. Finally, choose an appropriate method as a response.

For example,

Private Sub btnSubmit_Click()

MsgBox ("Hello World")

End Sub

In the example above, the command is a button and event is click(). When the user clicks the button, the response if a method – Message box with “Hello World” as message.

The output of the code is displayed below.