Greg --
Your proposed solution does indeed look like what I have done in other cases -- but, in this case, I asked specifically about BindEvent because I am not able to modify FormA.
FormB is actually a utility I'm working on for FoxCharts and will be provided in the Samples folder for FoxCharts. The intent is that it be called from any form that displays a chart (to make on-the-fly modifications to the chart) -- and so a solution that makes it self-contained, with no other modifications to the calling form, is desirable.
Thanks, though.
>>I have the following case:
>>
>>FormA opens FormB, passing an object reference to FormB.
>>
>>Thus the Init in FormB looks like this
>>
>>Lparam toObject
>>This.oObject = toObject
>>
>>I would like to use BindEvent here so that closing FormA close will close FormB. (This is essential, since the object reference keeps FormA from closing..)
>
>Don't need to use bindevents here. Instead define a custom property in FormA -- call it oFormB and set value to NULL. Then in calling FormB from FormA use the following syntax:
>
>
>DO FormB Name thisform.oFormB
>
>
>Now in the Destroy event method for FormA put the following:
>
>
>IF !ISNULL(thisform.oFormB)
> thisform.oFormB.Release()
>ENDIF
>
>
>In the Destroy event of FormB put the following (this is to reset the property if the user closes FormB):
>
>
>thisform.oObject.oFormB = .NULL.
>
>
>I have used this a number of places without problems.
Jim Nelson
Newbury Park, CA