Visual Basic Concepts

Introduction to Procedures

You can simplify programming tasks by breaking programs into smaller logical components. These components — called procedures — can then become building blocks that let you enhance and extend Visual Basic.

Procedures are useful for condensing repeated or shared tasks, such as frequently used calculations, text and control manipulation, and database operations.

There are two major benefits of programming with procedures:

  • Procedures allow you to break your programs into discrete logical units, each of which you can debug more easily than an entire program without procedures.

  • Procedures used in one program can act as building blocks for other programs, usually with little or no modification.

There are several types of procedures used in Visual Basic:

  • Sub procedures do not return a value.

  • Function procedures return a value.

  • Property procedures can return and assign values, and set references to objects.

For More Information   Property procedures are discussed in "Programming with Objects."

To learn more about Sub and Function procedures, see the following topics: