Microsoft KB Archive/184218

= Formexit.exe EXIT Command May Leave Form Object Visible =

Article ID: 184218

Article Last Modified on 3/11/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q184218



SUMMARY
Formexit.exe is a sample file that that shows how adding an EXIT command to a FOR...NEXT loop that iterates through a series of Application.Form objects can leave a form object on the desktop. The example also provides a workaround to the problem.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Formexit.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. This example has three forms, One, Two, and Three that sequentially appear. In the Activate event code of each form, a FOR...NEXT loop uses the Application.Form object to check if a form exists and changes the Caption property of a label object. If the FOR...NEXT loop is terminated by an EXIT command, it prevents Visual FoxPro from discarding the first form, and the form is left in memory.

To work around this problem, remove the EXIT command from the FOR...NEXT loop. This change allows the loop to complete, and the first form disappears.

Steps to Reproduce Behavior

 * 1) Copy the Formexit.exe file to a directory on your system and run it to extract the sample files.
 * 2) To run the application and follow the instructions on the forms that appear, type the following in the Command window: DO Formexit.app After following the instructions, the form titled One remains on the desktop.
 * 3) To exit the example, activate form Three and press the Clear Events button. Activate the Command window by pressing the CTRL and F2 keys simultaneously and type "CLEAR ALL" (without quotes) in the Command window.
 * 4) To implement the workaround, modify the project, open Frmone and open the Activate event. Comment the EXIT command by placing an asterisk (*) character in front of the line.
 * 5) Repeat the same steps to the other two forms.
 * 6) Rebuild the application and run the application file. Notice that Frmone now closes properly.

Keywords: kbinfo kbdownload kbfile KB184218

-

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

© Microsoft Corporation. All rights reserved.