Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: With Collections or FOR EACH...
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00841263
Message ID:
00841983
Views:
29
>>>Hmmm, I seem to recall that I had that same problem with VFP and Excel a couple of years ago as well. I have noticed I no longer need a CLEAR ALL. I have since moved on to Office XP and the current versions of VFP as they cam along. So I do not know if the problem was corrected in Excel, VFP or both.
>>
>>After doing some testing this behavior also exists in VFP 7.0 SP1. IOW, the data type changes to logical as soon as you hit the exit statement.
>>
>>Surprising that no one noticed this before.
>
>I know I have done that before, I guess I just never needed to return the "found" object reference before now. So what the variable flipped to after the looping never mattered to me until now.

Maybe this 'trick' helps:
LOCAL loCol as Collection, loItem, loFound

loCol=CreateObject('collection')
loCol.Add(_SCREEN,'test')

For each loItem in loCol
	loFound=loItem
	EXIT
EndFor
? loItem.Caption &&Doesn't work
? loFound.Caption &&Does work
Regards,
Frank Camp
Previous
Reply
Map
View

Click here to load this message in the networking platform