Visual Basic 6 Controls

Advertisements
Advertisements

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.

Advertisements

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.

Advertisements

The output of the code is displayed below.

VB Method and Events
VB Method and Events

Visual Basic 6 For Dummies 1st Edition

Create your own custom Visual Basic programs fast for Windows 95, Windows 98, and Windows NT!

If you want to develop business applications for Windows, then Microsoft’s Visual Basic 6 programming environment is for you. With its powerful and friendly object-oriented interface, Visual Basic 6 is the ideal tool for creating easy-to-use and attractive interfaces of your own. Whether you want to build original programs from the ground up or take advantage of existing wizards, Visual Basic 6 For Dummies will help you design and debug your work – and accomplish all your goals!

  • Covers using Visual Basic 6 with Windows 95, Windows 98, and Windows NT
  • Walks you through the ins and outs of object-oriented programming in Visual Basic and using the Visual Basic toolset
  • Shows you how to make use of menus and submenus, write subprograms that everyone can share, save and retrieve information in databases, integrate ActiveX controls into your applications, and build attractive user interfaces with buttons, boxes, and scroll bars

From the fundamentals of writing BASIC code to the thrill of distributing your very own custom applications, Visual Basic 6 For Dummies brings a fresh perspective to programming in Visual Basic 6 that everyone can understand.

Advertisements
Advertisements
Advertisements