Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you reference an object on a form without Thisfor
Message
From
07/05/2008 14:29:41
 
 
To
07/05/2008 14:22:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Miscellaneous
Thread ID:
01315695
Message ID:
01315700
Views:
19
In form A, when you call form B, pass THISFORM as a parameter:
DO FORM FormB WITH THISFORM
In the form B, add a property to contain the form A reference and fill it in the Init of the form:
LPARAMETERS toForm AS Form

THIS.oFormA = m.toForm
Then you can reference public methods/properties from form B with
THIS.oFormA.MyFunction ()
Don't forget to release the property in the Destroy event:
THIS.oFormA = NULL
>I've used "Thisform" extensively when reading data from a control into a local variable, i.e., "lcTextOutput1Value = thisform.text_output1.value" but I don't know how to reference this control from a different form. For instance, let's say form "A" has a text_output control1, just mentioned above, and I have a commmand button on that form that launches form "B." How do I reference the form A control directly when focus is on form "B?"
>
>I'm sure there's an easy way to reference a form's controls directly by just using the form's name instead of "thisform" but I haven't figured it out yet.
Previous
Reply
Map
View

Click here to load this message in the networking platform