Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I get rid of all forms from memory
Message
 
 
À
20/11/2000 10:26:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00443633
Message ID:
00443648
Vues:
10
Mark,

>When my program encounters an error I would like to be able to open the form straight away.
>
>At present I have to do a
>
>CANCEL (if I have suspended it)
>CLEAR ALL
>
>I do not like using clear all because it clears out the entire environment.
>
>I expected the lines below to release my forms from memory whilst leaving everything else
>
>FOR x = 1 TO _screen.FormCount
> _screen.Forms(x).release()
>ENDFOR
>

First off, you need to loop through Forms in reverse order. As you release each form, the Forms collection shrinks in size. You will eventually throw an error because x will be greater than the size of Forms.

>It does work but it crashes if I have the form designer window open because it is trying to release that as well as the forms I want to get rid of.
>
>I get the message xxxxxxx is not an object. I have tried using VARTYPE() but it returns 'O' for form designer windows
>
>How can I tell the above line of code to ignore form designer windows.
>
>

You can use the Parent property of the form to determine if it is part of a Formset. The form designer is just a formset wrapper for your form. If you don't use formsets and the form you are attempting to release is part of one, then don't release it.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform