Declaring Variables in FoxProID: Q122907 2.5x 2.60 2.60a 3.00 WINDOWS kbprg The information in this article applies to:
SUMMARYThs article describes how variables are defined (declared) in FoxPro. A variable in FoxPro can have one of three attributes: Public, Private, or Hidden.
MORE INFORMATION
Public VariablesPublic variables, also known as global variables, are variables that may be used and modified by any FoxPro program and any of its sub-programs for the duration of the FoxPro session or until the variable is cleared from memory. Public variables are declared in one of two ways: 1. Create a variable in the Command window. Any variable created in the 2. Within a program, declare a variable as public by using the PUBLIC
Private VariablesPrivate variables are declared within programs or procedures and can be used and manipulated within that program or procedure and any of its sub-programs. Private variables are declared one of three ways: 1. Create a variable inside a program or procedure without declaring is as 2. Include the variable on a PARAMETERS statement. This automatically
3. Use the PRIVATE command on variables declared previously. This makes
Hidden VariablesVariables may not be declared hidden, but variables that were previously declared as Public or Private may become hidden. By hiding variables created in higher programs, you can enable variables of the same name to be manipulated in the current program without affecting the values of the hidden variables. Once the program or procedure containing the private variables completes execution, all memory variables and arrays that were subsequently hidden are again available. Variables are hidden in one of two ways: 1. If a variable has already been declared, use the PRIVATE command 2. Use a variable of the same name in a PARAMETERS statement. If a newly
To check the status of a variable, use the DISPLAY MEMORY command. DISPLAY
MEMORY provides information about user-defined variables -- whether they
are public, private, or hidden, and where (which program or procedure) they
were declared.
REFERENCESLanguage Reference, version 2.5 pages L3-751, L3-764 Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg KBSubcategory: FxprgGeneral
|
Last Reviewed: May 1, 1996 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |