>I thought about it but it is a nonsense as i do the job with the loop
>
>for i = Myobj.controlcount to 1
>endfor
>
>I supposed there was something like hidden index as Fabio told me but I wanted to be sure about it. :-)
It's just that you're going down the list while deleting from the list. So the list changes below your feet, so to speak. When you delete element #1, what happens to the list? Does element #1 become empty, or does element #2 become #1, and #3 become #2? That's surely the case with some of object collections (like _screen.forms), and that'd be the explanation why deleting from the end
for i = Myobj.controlcount to 1
step -1 myobj.removeobject(myobj.controls[i].name)
endfor
works, while going up it deletes only odd elements while keeping the even ones.
Somewhere in the help I read that For Each is supposed to be immune to this skipping, and should work regardless of how many elements you insert or remove - but Sergey found this not to be the case.
My heavy handed solution was for the case where even ...step -1 doesn't work, if there's such a case.