Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controls collection
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00675459
Message ID:
00675463
Vues:
18
I don't know for sure, but there's what I think happens. The controls collection is an array of controls and FOR EACH iterates thru it starting with the first element. When you remove the first object the second one moves into it place and VFP moves to the second element of array. and so on. Try to remove controls from the end of array.
FOR i= ThisForm.ControlCount TO 1 STEP -1
   ThisForm.RemoveObject(ThisForm.Controls(i).Name)
ENDFOR
>Hi everyone, I am trying to nail down a problem and I noticed this:
>if I use the following code in the exit method of my form
>
FOR EACH loControl IN ThisForm.Controls
>    ThisForm.RemoveObject(loControl.Name)
>NEXT
>The code is exiting the loop halfway through (there are 18 controls)
>
>can anyone explain why this would occur? I would have thought a FOR..EACH loop would check every item
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform