Microsoft KB Archive/273483

= PRB: Form.Show Within WITH Block Prevents Release of Modal Form =

Article ID: 273483

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q273483



SYMPTOMS
If you attempt to use the Show method within a WITH...ENDWITH block in a modal form, issuing a ThisForm.Release method call does not release the form. In Visual FoxPro version 6.0, clicking the Close Box in the upper-right corner of the form closes the form, but does not close the form in Visual FoxPro version 3 or 5.



CAUSE
The form does not release because the WITH command is holding an outstanding object reference.



RESOLUTION
Issue the Show method of the form outside of the WITH block: WITH oForm .Caption = &quot;Erin&quot; .WindowState = 2 ENDWITH oForm.Show(1)



Steps to Reproduce Behavior
  Create a form class: CREATE CLASS frmWith AS form OF withShow.vcx   Add a command button to the form with the following code in its Click event, and then close the form: ThisForm.Release   To show the form, run the following code: SET CLASSLIB TO withShow ADDITIVE oForm = CREATEOBJECT(&quot;frmWith&quot;)

WITH oForm .Caption = &quot;Ael&quot; .WindowState = 2 .Show(1) ENDWITH  Click the command button, and note that the form does not release. In Visual FoxPro 6.0, click the Close Box to close the form; in earlier versions, click Cancel from the Program menu.

Keywords: kbcodesnippet kbprb kbctrl kbpending KB273483

-

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

© Microsoft Corporation. All rights reserved.