Data Storage Containers

You choose a data storage container according to the amount and type of data, and how you want to use it. You determine the availability of data by the way you declare it and where you create it in the program. This range of availability or effectiveness is called scope.

Most programming languages make it possible for you to store data in constants, variables, and arrays. In Visual FoxPro, you can also store data in records and objects. For more information about differences, see Visual FoxPro and Other Programming Languages.

Scope of Data Containers

The following table summarizes the scope differences between data containers.

Container Scope Example
Constants Private
#DEFINE ERRSTR "Error!"
Variables Public, private, or local
Var = 7
Arrays Public, private, or local
ArrayName[1,1] = "John Brown"
Fields Permanent storage, accessible while the table containing the records is open
REPLACE name WITH "John Brown"
Object Properties Referenced through the object and the object's container hierarchy
txtCustomer.Value = "John Brown"

See Also

Access to Variables | Arrays | Constants | Fields | LOCAL Command | Objects | PRIVATE Command | PUBLIC Command | Records | Variables | Object Properties | Visual FoxPro and Other Programming Languages | Overview of the Language