Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
For each doesn't release all forms?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01241310
Message ID:
01241387
Vues:
55
This message has been marked as the solution to the initial question of the thread.
Naomi,

>Hmm, I'm not sure, this needs to be comfirmed. I thought "for each" should work even when adding or removing. I need to review my own FAQ again, I already switched to George's solution but it didn't help yet.

I wrote this example while playing and fighting, so I am risking my Command Ship, meaning that my example might not be quite right, but take a look at this
loMyCollection	= CREATEOBJECT('Collection')
WITH loMyCollection as Collection
	.Add('A', 'A')
	.Add('B', 'B')
	.Add('C', 'C')
	.Add('D', 'D')
	.Add('E', 'E')
ENDWITH


FOR EACH lcLetter IN loMyCollection
	? 'Current letter: ', lcLetter
	IF lcLetter = 'C'
		? 'Removing ' + lcLetter
		loMyCollection.Remove('C')
	ENDIF
ENDFOR
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform