Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FOR EACH....
Message
From
24/06/1998 17:59:13
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
23/06/1998 17:43:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00111062
Message ID:
00111395
Views:
16
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform