Hi Roi,
>
>The _screen.forms is a collection and is LIFO (last in / first out). What's happening is the foreach moves down through the collection closing forms as it goes, but each time a form is closed, all the remaining forms move up in the collection. Also, the forms collection will contain any toolbars so you need to trap for them.
Not exactly. The order of a LIFO stack is static only responding to PUSHes and POPs. A good example of a LIFO stack in VFP are menus. The forms collection isn't really a LIFO stack, because the order of it is changed each time a window is activated. The most recently activated form is brought to the top (this excludes toolbars, if present, which will always preceed the forms.
You're correct about closing them. One should start at the last form in the collection and work upward.
George
Ubi caritas et amor, deus ibi est