Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to close all forms?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00284684
Message ID:
00285066
Views:
22
>Hi George,
>
>I would rethink this if I were you, what happens when QueryUnload returns .F., then you continue on all honkey dorey. This is what I might do:
>
>
local llFailed
>for lnX = 1 to _screen.FormCount
>   if !_screen.Forms(lnX).QueryUnload()
>      llFailed = .T.
>      EXIT
>   endif
>endfor
>
If !llFailed then close down your forms. This is like a transaction type deal, if one of the forms can't close, none will.

Hi Mike,

First, you've fallen into the trap of starting at 1 and trying to go upward. Won't work.

Second, you're right about this oversight. However, note that it will close all the forms where QueryUnload doesn't fail. In other words, it won't blow up. Better might be to add a second variable (logical) as part of the DO WHILE and, if desired use it as a terminating condition for the loop.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform