Information générale
Catégorie:
Codage, syntaxe et commandes
That make sense. Thanks for the information Roi.
>This came up the other day in the ExamStudyGroup in the wiki. The problem is FOR EACH walks through the collection 1 form at a time. As each object is destroyed, the remaining objects move up 1 place in the collection. When it gets half way through the collection all the forms in the last half are now in the front half (I think the effect is that it skips every other one).
>
>I think Craig pointed it out, Mike came up with the solution, I didn't believe it, Nancy tested it, and then Nancy hit me with a fish. :)
>
>Better would be:
>
>** Note we will use nFormIndex to move ahead in the collection
>** if a form can't be relased.
>nFormIndex = 1
>For x = 1 to _screen.FormCount
> oForm = _screen.Forms[ nFormIndex ]
> IF oForm.QueryUnload()
> oForm.Release()
> else
> nFormIndex = nFormIndex + 1
> ENDIF
>endfor
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement