Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with dangling reference
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01539074
Message ID:
01539309
Views:
75
>>>>>
>>>>>FOR EACH oForm in Application.Forms
>>>>>   IF TYPE("oForm.name") = "C"
>>>>>      oForm.Release()
>>>>>   ENDIF
>>>>>ENDFOR
>>>>>
>>>>
>>>>This releases the odd (ffirst, third, fifth, ..) forms only.
>>>
>>>Because of the way a collection works versus an array of object references. I had missed the use of the collection, that will do exactly what you saw.
>>
>>And contrary to what others may have said the test for the data type of the name property WILL prevent the error that was originally asked about, it will not make the collection work like an array.
>
>You should never try to remove an object from collection while iterating through collection.

I said I missed the FOR EACH use, but you said that testing for the TYPE of the property would NOT prevent the error that was originally asked about and that is simply NOT true. If you would like to engage in a discussion please first be sure you know what you are talking about.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform