Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange behaviour in deleting object
Message
 
 
To
08/08/2006 12:00:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01143804
Message ID:
01143828
Views:
6
I run some tests and looks like FOR EACH has similar problem as for i=1 TO ... when deleting items, it skips each even item. You'll have to stick with for i = this.mycontainer.controlcount to 1

>I built a container which I populate with a number of checkboxes depending on a certain table.
>To do that i removeobject all the checkboxes in the container, then addobjects again reading the table.
>
>I tried with
>
>for each oCheck in this.Mycontainer.objects
>    if lower(oCheck.baseclass) == 'checkbox'
>       this.removeobject(oCheck.name)
>    endif
>endfor
>
>
>but i found out that one of the objects was not removed
>so i'm using this code
>
>
>for i = this.mycontainer.controlcount to 1
>    if lower(this.mycontainer.controls(i).baseclass) == 'checkbox'
>       this.mycontainer.removeobject(this.mycontainer.controls(i).name)
>    endif
>endfor
>
>
>why that ?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform