Introduction to Procedures and Functions


Introduction to Procedures



A procedure is a small program that is meant to solve a relatively small problem. In fact, sometimes it is called a sub-program. A program developer writes the procedure and a user (the user is either you or another programmer) would only see the result. There are two categories of procedures you will use in your programs: those that have already been created thus made available to you, and those you will create yourself.

Creating a Procedure

You can create a procedure manually or, if you are using Microsoft Visual Studio, code can be generated for you. To manually create a procedure, start by typing the Sub keyword followed by a name (like everything else, a procedure must have a name). At the end of the procedure, you must type End Sub. Therefore, the primary formula of a procedure is:

Sub ProcedureName()

End Sub

The name of a procedure should follow the rules of names in the Visual Basic language. In addition:




Previous Copyright © 2008-2015, FunctionX, Inc. Next