Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Leftover class instance
Message
 
 
To
21/11/2007 14:24:00
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01270548
Message ID:
01270690
Views:
21
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform