LOCAL Command
Collapse the table of content
Expand the table of content

LOCAL Command

Visual Studio .NET 2003

Creates local variables and variable arrays.

LOCAL [ARRAY] ArrayName1(nRows1 [, nColumns1])   [, ArrayName2(nRows2 [, nColumns2])] ...    [AS type [OF ClassLib]]


Specifies one or more local variables to create.
[ARRAY] ArrayName1 (nRows1 [, nColumns1])   [, ArrayName2 (nRows2 [, nColumns2])] ...
Specifies one or more local arrays to create. See DIMENSION for a description of each argument.
AS type
Specifies the data type on which this variable or array is based.
OF ClassLib
Specifies the class library containing the type description on which the type element of this variable or array is based.


Items within VarList are separated by commas. Local variables and variable arrays can be used and modified only within the procedure or function in which they are created, and cannot be accessed by higher- or lower-level programs. Local variables and arrays are released once the procedure or function containing the local variables and arrays completes execution.

Variables and arrays created with LOCAL are initialized to false (.F.). Any variable or array you wish to declare as local must be declared local prior to assigning it a value. Visual FoxPro generates an error message if you assign a value to a variable or array and later declare it local with LOCAL.

Local variables can be passed by reference.

You cannot abbreviate LOCAL because LOCAL and LOCATE have the same first four letters.

The strong typing required by the CodeSense parser in IntelliSense is available only when you create strongly typed object and variable references by using the optional AS clause.

When you specify a valid classname, Visual FoxPro uses the typelib (if you specify a ProgID) or instantiates the object to get the list of Properties, methods, and events. If the specified classname is not found, Visual FoxPro displays a dropdown list of available classes.

See Also


© 2015 Microsoft