Share via


Visual Basic Concepts

Programming Fundamentals

This chapter introduces the essential components of the Visual Basic language. After creating the interface for your application using forms and controls, you will need to write the code that defines the application's behavior. As with any modern programming language, Visual Basic supports a number of common programming constructs and language elements.

Visual Basic is an object-based programming language. The mere mention of objects may cause undue anxiety in many programmers. Don't worry: whether you realize it or not, you've been dealing with objects most of your life. Once you understand a few basic concepts, objects actually help to make programming easier than ever before.

If you've programmed in other languages, much of the material covered in this chapter will seem familiar. While most of the constructs are similar to other languages, the event-driven nature of Visual Basic introduces some subtle differences. Try and approach this material with an open mind; once you understand the differences you can use them to your advantage.

If you're new to programming, the material in this chapter will serve as an introduction to the basic building blocks for writing code. Once you understand the basics, you will be able to create powerful applications using Visual Basic.

Topics

The Structure of a Visual Basic Application

An introduction to the various components or modules that make up a Visual Basic application.

Before You Start Coding

A brief discussion of some of the considerations in designing an application.

Code Writing Mechanics

An introduction to the features of the Code Editor, plus the rules and regulations for writing code.

Introduction to Variables, Constants and Data Types

An introduction to the basic elements of the Visual Basic language.

Introduction to Procedures

An introduction to Sub and Function procedures.

Introduction to Control Structures

An introduction to decision structures and loops.

Working with Objects

An introduction to using objects in Visual Basic code.

Sample application

Vcr.vbp

Many of the code samples in this chapter are taken from the Vcr.vbp sample application which is listed in the directory.