Entering Declarations in Code
Declarations are nonexecutable code statements that name external procedures, constants or variables and define their attributes (such as data type). You write declarations for forms or modules . To enter module-level declarations, go to the Declarations section of the form or module. To enter global declarations, go to the Declarations section of a module and use the Global statement for constants and variables.
You can also enter procedure-level declarations. For whatever code level and technique you use to declare a variable or constant, specific scoping rules may apply. For details on scoping declarations, see Chapter 7, "Variables, Constants, and Data Types," in the Programmer's Guide.
To open the Declarations section for a form
1. Double-click the form to open the Code window .
2. In the Object box, select (General).
The Procedure box automatically displays (Declarations).
3. Enter the declarations you want, following the guidelines for entering and editing code.
To open the Declarations section for a module
1. In the Project window , select the module you want to open and click the View Code button.
2. In the Procedure box, select (Declarations).
3. Enter the declarations you want.
Note Visual Basic comes with the file CONSTANT.TXT. This file specifies system defaults such as colors, key codes, and defaults for properties and events . You can load CONSTANT.TXT into any module and modify it to your specifications.
Chapter 2, "Your First Visual Basic Application".
Chapter 7, "Variables, Constants, and Data Types"