TechnologyUK - Programming (VB6) Logo

Coding the Application

In any Visual Basic application, the Visual Basic programming language will be used to create program code. The task of the programmer is to provide a solution to a problem in the most economical way. In order to write efficient code that works, the programmer must be familiar with their chosen programming language in terms of its built-in commands, syntax and grammar. This kind of knowledge takes time to acquire, and involves frequent reference to appropriate literature (such as the Microsoft Visual Basic 6.0 Programmer's Guide). Some of the main elements of the Visual Basic programming language are described below.

Most of the program code you write will be event procedures which will execute in response to the occurrence of various events. Code does not have to reside inside an event procedure, but is always called from within an event procedure. If you double-click on an object in the IDE you'll be presented with the code window for that object. The two dropdown lists available in the code window show the list of available objects in the application, and the events supported by each object. The item General in the first dropdown list refers to the section in which VB automatically places any user-defined functions and subroutines. An event procedure attached to a specific object is (usually) only executed when the specified event occurs, whereas a function or subroutine can be called from any event procedure in the application.