Nadya,
I see Fred got you an answer. Another way of dealing with the issue is to work backwards through the collection:
for i = _screen.FormsCount to 1 step -1
if ( _screen.Forms[i].Name != thisform.Name )
if ( _screen.Forms[i].QueryUnload() )
_screen.Forms[i].Release()
endif
endif
endfor
>Hi David,
>
>>Nadya,
>>
>>In your Main.Release() method you can iterate through the _screen.Form[] collection and call _screen.Form[i].Release() for all the other forms. You don't want to try to Release() the main form because you'll infinite loop.
>
> I've tried this before and I still have a problem here. I wrote this code in RELEASE() method of the main form:
>
>if used("tregion")
> use in tregion
>endif
>= tableupdate(.t., .t., "BldMstr")
>
>FOR i=1 TO _SCREEN.FormCount
> =MESSAGEBOX(_screen.forms(i).name)
> IF (UPPER(_SCREEN.FORMS(i).NAME)<>"ZIPS") && ZIPS is the name for the main form
> _SCREEN.FORMS(i).RELEASE()
> ENDIF
>ENDFOR
>DODEFAULT()
>
> After running this code I have an error message: "FORMS is not an object". Then I can not quit from my form and only one way to quit - quit from the FoxPro.