PRB: Cannot Get Individual Items from the Projects Collection (196023)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q196023

SYMPTOMS

Referencing a project collection's item without the keyword 'Item' may cause the following error:
File '<filename>' does not exist.

RESOLUTION

To access an individual item, use the following syntax:
   oProj = APPLICATION.ACTIVEPROJECT
   oFiles = oProj.FILES
   oFile = oFiles.Item[1]
   ?oFile.NAME
				

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

Run the following code from a program file with a project in memory that has at least one file attached to it:
   oProj = APPLICATION.ACTIVEPROJECT
   oFiles = oProj.FILES
   oFile = oFiles[1]
   ?oFile.NAME
				
RESULTS: The third line returns the following error:
File 'ofiles.prg' does not exist.

Modification Type:MajorLast Reviewed:12/10/1999
Keywords:kbprb kbProjManager KB196023