>I just wanted to know if anyone else had performance problems associated with looping through the Files Collection of the Project Object in VFP6. This code works, but is EXTREMELY slow. I've got about 600 files in my project and it takes over 1 second to process this loop one time. Just open any VFP6 project onto the desktop and run this code in a prg.
>
>WITH _VFP.Application.ActiveProject
> nFileCount = .Files.Count
> ? alltr(str(nFileCount)) + " total files in the project."
>
> FOR nCount = 1 TO nFileCount
> nTime = seconds()
> set message to "File=" + .Files.Item(nCount).Name
> ? "Loop Time=" + alltr(str(seconds() - nTime,10,6))
> ENDFOR
>
>ENDWITH
>
>I know VFP has problems with enumerations (FOR EACH - see
http://members.home.net/bmassi/gotchas.htm) and if I use it here instead of the FOR..NEXT loop then VFP stops responding.
>
>I'm starting to wonder about VFP and its handling of collections. I'm begining to think we've got a problem.
So far, all of the evidence of a problem is with VFP and its handling of COM collections. The ADO example, and the Project manager example are both iterating through collections in a COM interface. I haven't tested this to compare with a native VFP object (I didn't have one handy with a big enough collection) so I can't say if this is true or not- I just wanted to point out that your examples show no evidence of a problem with native VFP objects. (The project object is NOT a native VFP object).
Erik Moore
Clientelligence