PRB: ControlSource Variables not Visible until Text Box Selected (196086)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q196086 SYMPTOMS
If you base the ControlSource of a text box on a private or local memory
variable and is the text box is populated before the form runs, then the
variable is not visible to the methods or events of the form and its
components until you select the text box by either clicking the text box or
tabbing to the text box.
CAUSE
When the form is first instantiated, the memvars are still in scope. After
the form has fully instantiated, the .prg file continues and ends,
releasing the memvars. You can still see the values in the text boxes
because the values were read before the memvars went out of scope. When you
click the text box, it tries to refresh from the Controlsource. However,
the Controlsource memvar does not exist, so the text box creates the
memvar, and stores the current text box value in that memvar.
RESOLUTION
Following are two workarounds:
- Place a READ EVENTS after calling the form as follows:
CLEAR ALL
USE MyTbl
SELECT MyTbl
SCATTER MEMVAR
DO FORM MyFrm
READ EVENTS
-or-
- Declare the memory variable as public.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbContainer kbCtrl kbprb KB196086 |
---|
|