Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing with dangling reference
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01539074
Message ID:
01539234
Vues:
54
>>>>
>>>>FOR EACH oForm in Application.Forms
>>>>   IF TYPE("oForm.name") = "C"
>>>>      oForm.Release()
>>>>   ENDIF
>>>>ENDFOR
>>>>
>>>
>>>This releases the odd (ffirst, third, fifth, ..) forms only.
>>
>>Because of the way a collection works versus an array of object references. I had missed the use of the collection, that will do exactly what you saw.
>
>And contrary to what others may have said the test for the data type of the name property WILL prevent the error that was originally asked about, it will not make the collection work like an array.

You should never try to remove an object from collection while iterating through collection.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform