How to Scope a Variable to a FormID: Q126952 3.00 WINDOWS kbtool The information in this article applies to:
SUMMARYThis article explains how to declare variables that exist and are visible throughout a form but are released when the form is released.
MORE INFORMATIONA variable declared in a method of a form is visible while the method is executing. Any reference to this variable after the method exits will yield a 'Variable not Found' error message. In Visual FoxPro, the Form Designer builds a Form class, and a Form is an object. Variables declared in a method such as the Init or Load are scoped to the method. A variable scoped to a Form object has to be a member variable, or property. This differs from the version 2.x model, where variables declared in the Setup of a screen would be generated at the beginning of the .SPR file, and be available to the program and procedures that the program calls. Use the following steps to add a new property to a Form in the Form Designer: 1. Choose New Property from the Form menu. 2. Type the name of the member variable, and click OK in the dialog. The 3. To refer to the property from an object in the Form, you can:
Additional reference words: VFoxWin 3.00 screen private
KBCategory: kbtool
KBSubcategory: FxtoolFormdes
|
Last Reviewed: May 1, 1996 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |