PRB: Visual FoxPro Creates Public Variable for ControlSourceLast reviewed: February 12, 1996Article ID: Q145929 |
The information in this article applies to:
SYMPTOMSIn a form, the scope of a variable set as a control source is public. This variable is declared in a program. By default, a variable declared in a procedure is private, so you would expect this variable to be private.
CAUSEThe form is running in a modeless environment. When the form is modeless, program execution does not pause after the form is displayed. When the program is completed, control is returned to the Command window. If the form is still displayed when you return to the Command window, users can input data. This means that the input variables need to be accessible. To prevent errors, Visual FoxPro automatically scopes input variables as public when the Command window is active. So, if the source of the data of a control is a variable, its scope is changed to PUBLIC when the Command window is accessed.
RESOLUTIONUse a modal form or a READ EVENTS to pause program execution and prevent the scope of the variable from changing. You can also declare the ControlSource variable as a property of a form to scope it to the form object.
STATUSThis is by design.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional reference words: 3.00 3.00b VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |