Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leftover class instance
Message
 
 
À
21/11/2007 14:24:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01270548
Message ID:
01270690
Vues:
20
>This code, which is called by a button,
>
>for each oControl in thisform.Controls
>	if oControl.class = "Mergeclass"
>		thisform.RemoveObject(oControl.name)
>	endif
>endfor		
>
>Leaves 1 instance of the target class remaining on the form. Any ideas why?
>I thought maybe it was a focus issue but focus is switched to the button when it is clicked.

I had fallen into the same trap few months ago, so I now I know that you can not remove an object from a collection using FOR EACH syntax. You need to use a counter and go in reverse order to remove items.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform