Share via


Data Storage Containers

You choose a data storage container according to the amount and type of data you need to store, 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

Arrays

Public, private, or local

ArrayName[1,1] = "John Brown"

Constants

PRIVATE Command

#DEFINE ERRSTR "Error!"

Fields

Permanent storage, accessible while the table containing the records is open

REPLACE name WITH "John Brown"

Variables

PUBLIC Command, private, or LOCAL Command

Var = 7

Objects

Referenced through the object and the object's container hierarchy

txtCustomer.Value = "John Brown"

See Also

Reference

Access to Variables

LOCAL Command

PRIVATE Command

PUBLIC Command

Records

Visual FoxPro and Other Programming Languages

Other Resources

General Reference