Formexit.exe EXIT Command May Leave Form Object Visible

ID: Q184218


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a


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. Click the file name below to download the file:

Formexit.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. 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.


Additional query words:

Keywords : kbfile kbVFp
Version : WINDOWS:5.0,5.0a
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: November 19, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.