Introduction to Programming Using Visual Basic 2005, An (6th Edition)

[Page 188 (continued)]

  1. A general procedure is a portion of a program that is accessed by event procedures or other general procedures. The two types of general procedures are Sub procedures and Function procedures.

  2. Sub procedures are defined in blocks beginning with Sub statements and ending with End Sub statements. A Sub procedure is accessed (called) by a statement consisting of the name of the procedure.

  3. Function procedures are defined in blocks beginning with Function statements and ending with End Function statements. A function is invoked by a reference in an expression and returns a value.

  4. In any procedure, the arguments appearing in the calling statement must match the parameters of the Sub or Function statement in number, type, and order. They need not match in name.

  5. A variable declared in the Declarations section of the Code window is class-level. Such a variable is available to every procedure in the form's code and retains its value from one procedure invocation to the next.

  6. Variables declared with a Dim statement inside a procedure are local to the procedure. The values of these variables are reinitialized each time the procedure is called. A variable with the same name appearing in another part of the program is treated as a different variable.

  7. Structured programming uses modular design to refine large problems into smaller subproblems. Programs are coded using the three logical structures of sequences, decisions, and loops.

Категории