Microsoft KB Archive/317491

= FIX: Project.Files.Count Property Does Not Increment Properly When You Add a File Through the User Interface =

Article ID: 317491

Article Last Modified on 2/26/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q317491



SYMPTOMS
When you add a file to a project through the Visual FoxPro 7.0 user interface, the Count property does not increment properly.



RESOLUTION
To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows 7.0. This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps to Reproduce Behavior
The following code will create a new project and add three files to the project. The program uses the project's ADD method to add the first two files to the project. The program then opens the Add dialog box in Visual FoxPro for you to add the third file to the project.

After the program adds each file to the project, the program prints the value of the Project.Files.Count property to the screen. Note that this value still returns 2 after you add the third file.

NOTE: The Count property also does not decrement correctly when you use the Visual FoxPro user interface to delete files from the project. You must close and reopen the project to refresh the Count property.

To reproduce the problem, follow these steps:   Paste the following code in a new program and run the program: CLEAR SET RESOURCE OFF IF TYPE('_VFP.ACTIVEPROJECT') != &quot;U&quot; _VFP.ACTIVEPROJECT.CLOSE ENDIF LOCAL lcText AS STRING CLEAR DELETE FILE testxx.pj? CREATE PROJECT testxx NOWAIT MOVE WINDOW &quot;Project Manager - Testxx&quot; TO 0,40 DELETE FILE testxx.prg =STRTOFILE(&quot;WAIT WINDOW 'Hello'&quot;,'testxx.prg',.T.) _VFP.ACTIVEPROJECT.FILES.ADD('testxx.prg') ? &quot;The value of the Count Property is &quot;+ ALLTRIM(STR(_VFP.ACTIVEPROJECT.FILES.COUNT)) _VFP.ACTIVEPROJECT.FILES.ADD(HOME+'ffc\_base.vcx') ? &quot;The value of the Count Property is &quot;+ ALLTRIM(STR(_VFP.ACTIVEPROJECT.FILES.COUNT)) _CLIPTEXT = HOME+'ffc\_dialogs.vcx' KEYBOARD '{tab}{DNARROW}{DNARROW}{DNARROW}' DOEVENTS KEYBOARD '{pause 1}' DOEVENTS KEYBOARD '{pause 1}{alt+o}a' DOEVENTS ? &quot;You just added a third file.&quot; ? &quot;The value of the Count Property is &quot;+ ALLTRIM(STR(_VFP.ACTIVEPROJECT.FILES.COUNT)) SET RESOURCE ON RETURN  When the Add dialog box appears, press CTRL+V, and then press ENTER to add the third file to the project. Note that the output to the screen indicates that Project.Files.Count still equals 2.
 * Select Classes node in tree
 * Select Project/Add from menu

Additional query words: kbVFP700sp1fix

Keywords: kbbug kbfix kbprojmanager kbcodesnippet KB317491

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.