Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object not found error using _screen.forms()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00201186
Message ID:
00201190
Vues:
12
>My coworker has a application that is using several forms. At one point he is closing all the forms (of a certain type) that the app has opened. I gave him some code that I had used in the past to do the same thing, but it did not work for him. He is getting a "Object not found" error after the first form is closed.
>
>The code is as follows:
>
>Store _SCREEN.FormCount to nTotForms
>For nCount = 1 to nTotForms
> If _SCREENS.forms(nCount).Name = "Myform"
> _SCREENS.forms(nCount).Release()
> Endif
>Endfor
>
>
>The problem seems to arise because the _screen.forms() collection has some index numbers that are "Undefined", but we don't know why. I found this out by putting Type("_SCREEN.forms(nCount)") in the debug window. If we had 5 forms open on most of them the "Type" command would return "o" for object but on one (usually in the middle: like nCount=3) "Type" would return "u" for undefined.
>
>Any one got any ideas??
>
>Help please.
>
>Mike

_SCREEN.Forms collection has unpleasant feature to shrink itself, i.e. when you release a member of this collection (form.release) it decreses its size on-fly. Therefore, you may just check
IF Type("_SCREENS.forms(n)")="O"
_SCREEN.Forms(n).Release
ENDIF
Most of frameworks (commersial or personal) use its own form manager collection/class which does not have this fault.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform