Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
Visual Basic and Visual FoxPro constants
VFP#DEFINE, #UNDEF, #INCLUDE
Visual Basic Syntax Notes
Constants in Visual Basic can be Private (the default) or Public and can optionally be defined as having a data type:
Visual Basic for Applications has a wide range of useful system constants such as vbBlue built into the language. Use the Object Browser from themenu in the Visual Basic window to search for constants.
Visual FoxPro Syntax Notes
Constants in Visual FoxPro are neither Public nor Private in the normal sense of the terms. They exist from the moment that they are created with #DEFINE until the moment that they are released with #UNDEF:
Do not try to put an '=' sign into the declaration of the constant.
Visual Foxpro include files
FoxPro also has the #INCLUDE directive which pulls a header file of constants into the program. This makes maintenance easier because you can then keep all the constants for a project in one external file rather than having to cut and paste the #DEFINE statements into every module.
The FoxPro.H file supplied with the language includes the definitions of many useful constants such as COLOR_BLUE. Unlike Visual Basic, these are not built into the language itself.
A form or a class can also use a constant file. Rather than using the #INCLUDE statement you selectfrom the or menu as appropriate. You can also set up the FoxPro options to specify a default include file.
It is possible to chain these include statements so that a project may have an include file which itself pulls in the standard FoxPro.H:
*-- This indicates that there are no entries here - it starts with a "-" so that
*-- it sorts to the head of any list. Similarly for "All" entries.
#DEFINE NOENTRIES "-None-"
#DEFINE ALLENTRIES "-All- "
*-- We need something more meaningful than .F. and .T. when displaying
*-- Boolean values.
#DEFINE APP_FALSE "False"
#DEFINE APP_TRUE "True"