>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.