Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FOR EACH....
Message
De
24/06/1998 17:59:13
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/06/1998 17:43:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00111062
Message ID:
00111395
Vues:
17
>For example I want to Remove All objects on a form, I was trying to do something like:
>
>FOR EACH oControl IN ThisForm.Controls
>ThisForm.RemoveObject(oControl.Name)
>ENDIF
>Of course it's not working and I'm not suprised, but it's very interesting how this thing suppoused to be to get it work.

Oshibka... you should do

ThisForm.RemoveObject(oControl)

But then, it won't work either, because you're going through an array and killing its elements on the way, so somewhere halfway it will try to reference an element which doesn't exist anymore. You should do a trick like this:

do while thisform.controlcount>0
ThisForm.RemoveObject(thisform.controls[thisform.controlcount])
endd

This way you're always shooting at the last one in the list, and just waiting for the list to get exhausted. You could shoot at the first one, just the same; any other number may vanish during the process.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform