Microsoft KB Archive/143298

= How to Use Indirect Referencing of Objects Creatively =

Article ID: 143298

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q143298



SUMMARY
Visual FoxPro allows indirect referencing of objects with THIS, THISFORM, THISFORMSET, and object.PARENT. With a little code, you can expand this list to include THISPAGEFRAME and THISPAGE. The example in this article will not work with the Init event of an object, however it can be used elsewhere.



Step-by-Step Example
 Create a new form, and place a pageframe on the form.  Add the following code to the Page1.Activate event: ********* Begin Page1.Activate ********* PUBLIC THISPAGEFRAME, THISPAGE THISPAGEFRAME=THIS.PARENT THISPAGE=THIS ********* End Page1.Activate ***********   Add the following code to the Page1.Deactivate event: ********* Begin Page1.Deactivate ********* RELEASE THISPAGEFRAME, THISPAGE ********* End Page1.Deactivate  Repeat steps 2 and 3 for Page2 using the exact same code.  Add a command button to Page1, and place the following code in the Click event for the command button: *********** Begin CommandButton.Click *************** THISPAGE.Caption="Visual FoxPro" *********** End CommandButton.Click *****************  Run the form. Click the command button. Note the Caption of page1 changes to Visual FoxPro.

NOTE: The INIT event of the objects would not recognize THISPAGEFRAME and THISPAGE.</ol>

Additional query words: VFoxWin

Keywords: kbcode KB143298

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.