Hi,
first something to try
You can access the datasession window with
SET VIEW ON
or
SET
in command window.
To check for unreleased forms enter MODIFY COMMAND in command window,
enter following program
LOCAL;
loForm,;
loTest,;
lnLoop
lnLoop = 0
SET STEP ON
FOR EACH loForm IN APPLICATION.FORMS
loTest = loForm.NAME
lnLoop = lnLoop+1
ENDFOR loForm
and run from context menu.
I remeber "Kill Objects Dead" from Doug Hennig, an article in
FoxTalk that discuss this problem.
If you own a copy of MSDN, it will be in the Periodicals / Periodicals 1999 / FoxPro / October /.
Also in FoxTalk is "With Aplomb" in 04/2001 from J Randy Person wich handles problems related to WITH ... ENDWITH.
Anyway, I still did'nt understand the use of "SET DATASESSION TO THISFORM.DATASESSIONID" in Destroy. In may understanding Datasession changes anyway if you call an other form's methods.
So normaly THISFORM.DATASESSIONID is always the active datasession if THISFORM..DATASESSION=2
If THISFORM..DATASESSION=1 than the datasession is used where form was created. But it is always actual in methods.
Use of "SET DATASESSION TO Not_ThisForms_Id" will cause horrible damage to THISFORMS Object CONTROLSOURCEs.
I use this command for an errorlog only.
Can you show me wich code causes the error ?
But wait, may be my english is not the best. Do I understand you call LOOKUP Form from form2 UNLOAD?
Have you checked the call stack in form1.cmdButtons second click, so that there is no crosswise calling and you stuck in form2.UNLOAD?
So you control form2 from form1. Maybe we do a workaround.
What about the following
Add a propety to form1 letsay goInput, defaultvalue = .NULL. and a property to form2 goParent defaultvalue .null..
In form1.release add
IF VARTYPE(THIS.goInput)='O' AND !ISNULL(THIS.goInput) THEN
THIS.goInput.RELEASE()
THIS.goInput = .NULL. &%not necessary
ENDIF VARTYPE(THIS.goInput)='O' ...
form.cmdButton.Click:
IF !VARTYPE(THISFORM.goInput)='O' OR ISNULL(THISFORM.goInput) THEN
THISFORM.goInput = CREATEOBJECT('FORM2')
THISFORM.goInput.goParent = THISFORM
ENDIF !VARTYPE(THISFORM.goInput)='O' ...
THISFORM.HIDE()
THISFORM.goInputSHOW()
Do not cleanup and destroy form2 after finishing input. I guess you use a kind of close button
IF VARTYPE(THISFORM.goParent)='O' AND !ISNULL(THIS.goParent) THEN
THISFORM.goParent.SHOW()
THISFORM.HIDE()
ELSE
ENDIF VARTYPE(THISFORM.goParent)='O' ...
So final release of form1 will cleanup both forms, an reuse of input form will speed up.
Lutz