Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing all Running forms
Message
From
19/10/1999 14:10:50
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00278293
Message ID:
00278364
Views:
15
>Hi Sylvain,
>
>This came up the other day in the ExamStudyGroup in the wiki. The problem is FOR EACH walks through the collection 1 form at a time. As each object is destroyed, the remaining objects move up 1 place in the collection. When it gets half way through the collection all the forms in the last half are now in the front half (I think the effect is that it skips every other one).
>
>I think Craig pointed it out, Mike came up with the solution, I didn't believe it, Nancy tested it, and then Nancy hit me with a fish. :)
>
>Better would be:
>
>** Note we will use nFormIndex to move ahead in the collection
>** if a form can't be relased.
>nFormIndex = 1
>For x = 1 to _screen.FormCount
> oForm = _screen.Forms[ nFormIndex ]
> IF oForm.QueryUnload()
> oForm.Release()
> else
> nFormIndex = nFormIndex + 1
> ENDIF
>endfor
>
>Hope this helps.
>
>>
FOR EACH oForm IN _Screen.Forms
>>   IF oForm.QueryUnload()
>>      oForm.Release()
>>   ENDIF
>>ENDFOR
HTH
>Can someone tell me how to close all the running form in the app. enviroment.

I tried your suggestion but i get a ' Property QueryUnload is not found ' message, although I know it's there. What am I missing.

I guess I should tell you that this code is running from a toolbar button. I'm using a "login as a different user", and that's why I need to close all running forms.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform