Loading Constants from CONSTANT.TXT or DATACONS.TXT

See Also8OUYLT

Two files included with Visual Basic, CONSTANT.TXT and DATACONS.TXT, provide many symbolic constantsTD9WSV you can use in your code.  For example, to set the background color of a form to the same color as the face of command buttons, you can either set a form's BackColor property to &H800000F, or you can use the symbolic constant BUTTON_FACE supplied in CONSTANT.TXT.  Using symbolic constants in your code makes it more readable, and you may find it easier to remember the symbolic constant than the specific value while entering code.  The constants are declared as global so they must be loaded into a code module, not a form.  To limit the scope of the constants to a form or procedure, change Global to Const in the declaration and paste them into the Declaration section of a form or procedure.

File                         Contains


CONSTANT.TXT     Constants used for general programming and for Visual Basic controls.

DATACONS.TXT     Constants supporting data access in Visual Basic.


To load CONSTANT.TXT or DATACONS.TXT into a code module

  1. In the development environment, choose the New Module command from the File menu.  This adds an empty code module to your project.

  2. Make sure the module is the active window, and then choose the Load Text command from the File menu.

  3. Select one of the files containing constants and choose the Replace button.  If you want to add a file to a module where you already have other declarations, choose the Merge button.

See Also

Const Statement3DARGS

Entering Declarations in Code1AS3HT9

Global StatementTDN897