Assigns data from a calling program to private variables or arrays.
- PARAMETERS ParameterList
Specifies one or more variable or array names to assign data to. Use commas to separate multiple parameters in ParameterList. Generally, you can pass a maximum of 26 parameters; however, in some circumstances, you can pass 27 parameters.
The PARAMETERS statement must specify at least as many parameters as used by the call to the program, procedure, or function containing the PARAMETERS statement. If more variables or arrays are listed in the PARAMETERS statement than are passed by the calling program, the remaining variables or arrays in the PARAMETERS statement are initialized to False (.F.).
- [ AS type [ OF ClassLib] ]
Specifies the data type of the variable or array and the class library containing the type description of type on which this variable or array is based.
You can use the AS clause to implement strong typing. IntelliSense functionality is available for object and variable references only when they are strongly typed. For more information, see.
When PARAMETERS is used with a program, procedure, or user-defined function called with the DO command, it must be the first executable statement in the called program, procedure, or user-defined function.
By default, the WITH clause in the DO command passes variables and arrays to procedures by reference. By default, Visual FoxPro passes arguments by value to user-defined functions.
To pass entire arrays to functions, you must pass them by reference. If you do not pass arrays to functions by reference, only the first element passes to the function. For more information, see.
For more information, seeand .
The following example passes parameters to an error-handling routine.
ON ERROR DO errhand WITH ERROR( ), MESSAGE( ), ; MESSAGE(1),PROGRAM( ),LINENO( ) USE nodatabase ON ERROR && restores system error-handling routine PROCEDURE errhand PARAMETERS gnError, gcMess, gnMess1, gcProg, gnLineNo ? 'Error number: ' + LTRIM(STR(gnError)) ? 'Error message: ' + gcMess ? 'Line of code with error: ' + gnMess1 ? 'Line number of error: '+ LTRIM(STR(gnLineNo)) ? 'Program with error: ' + gcProg