Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do form to - cannot return object - unload runs 2x
Message
From
16/08/2006 08:12:10
 
 
To
15/08/2006 13:25:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01145663
Message ID:
01145940
Views:
21
>back again. i think this might be a quick one but who knows.
>
>in one form ("form1") i issue a command "do form form2 to oretval_email"
>
>in form2, i have a command button that creates an "empty" object named oretval_email and i add properties to it. in the form's unload event, i have :
>
>lparameters oretval_email
>return (oretval_email)
>
>i was having some problems with this so i checked online and found that i also have to make sure that the destroy event of the command button has to have the variable/object available. therefore, i added the following lines to the command button's destroy event.
>
>lparameters oretval_email
>return (oretval_email)
>
>now, for the command button's click event, i added the following at the bottom to make sure the object was available to the other events:
>
>this.Destroy(oretval_email)
>thisform.Unload(oretval_email)
>
>my problem is that the object is available even at the point where the unload event occurs, but, for some reason, the unload event statement "return(oretval_email)" seems to run twice, and the second time makes the object ".f.".
>
>does anyone have any ideas how to correct this?
>

As an alternative to Jim's solution, add a property to the called form to hold the return value. Then, you don't have to worry about variable scope. In your button click:

This.oRetVal_Email = whatever

In Form.Destroy:

RETURN This.oRetVal_Email

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform