visual basic banner
Introduction | About | Commands | Appeal | Links | Terra Nova | IMOS 2K


Introduction

About

Commands

Appeal

Links

Terra Nova

IMOS 2K
   

 

      Visual Basic is based on the BASIC programming language. Like in all computer languages, BASIC has special commands called reserved keywords. These keywords cannot be used as a naming convention (i.e. like object or variables, etc.). Examples of reserved keywords are:

Loop Function Sub
End Do Else
If Integer Case
Select Then For

     Other parts of the BASIC programming language consist of Event Procedures and Objects.

     Event Procedures tell objects how to react to something a user does. Not every object needs procedures. Only objects that the user can click on or choose in some way require Event Procedures. Let's say you create an exit button on a form. You construct Visual Basic code commanding the program to exit once the user clicks on this button. An example of this code could be:

Private Sub cmdExit_Click()
Unload Me
End Sub

If we are to break this down,

  • Private Sub is short for subprogram. This becomes the subprogram for the object.
  • cmdExit is the object name for the button.
  • The underscore (_) is used to separate the object from it's event.
  • The event Click() is the user clicking on the button cmdExit.
  • Unload Me, which is made up of a keyword Unload and Me a variable that represents the form, closes the form on which the exit button resides.
  • The End Sub ends the commands for the subprogram.

 



Page last update: 04/02/2000
Created for the IMOS2K course - 1999-2000 Best viewed with I.E. 4 or higher / 800x600