Microsoft KB Archive/195273

= Fatal Exception C0000005 when removing form from a formset in Visual FoxPro =

Article ID: 195273

Article Last Modified on 1/27/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q195273



SYMPTOMS
When you type the command THISFORMSET.REMOVEOBJECT("FORM_NAME") to remove a form from a formset, a message box with following message appears:

Fatal error: Exception code = C0000005

After this message appears, Visual FoxPro terminates.



CAUSE
This behavior occurs when a form is removed from a formset using the following syntax: THISFORMSET.REMOVEOBJECT("FORM_NAME")



RESOLUTION
The behavior does not occur if the form is released from the formset.

Use the following syntax to release a form that is part of a formset: THISFORM.RELEASE



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For additional information about Visual Studio service packs, click the following article number to view the article in the Microsoft Knowledge Base:

194022 Visual Studio 6.0 service packs, what, where, why

194295 How to tell that Visual Studio 6.0 service packs are installed



Steps to reproduce behavior
 Close any open data files and exit any running applications.  Create a program file called RemFrm.prg using the following code: PUBLIC ox ox=CREATEOBJECT('testset') ox.SHOW

DEFINE CLASS testset AS FORMSET ADD OBJECT form1 AS test1 WITH ; TOP   = 0, ; LEFT  = 0, ; HEIGHT = 250, ; WIDTH = 375 ENDDEFINE

DEFINE CLASS test1 AS FORM DOCREATE = .T.  CAPTION = "Form1" NAME = "Form1"

ADD OBJECT command1 AS COMMANDBUTTON WITH ; TOP = 200, ; LEFT = 56, ; HEIGHT = 25, ; WIDTH = 241, ; CAPTION = "Add Form", ; NAME = "Command1"

PROCEDURE command1.CLICK THISFORM.HIDE THISFORMSET.ADDOBJECT("Form2","test2") THISFORM.ENABLED=.F.     THISFORMSET.FORMS[2].ENABLED=.T.      THISFORMSET.FORMS[2].SHOW ENDPROC ENDDEFINE

DEFINE CLASS test2 AS FORM TOP = 33 LEFT = 140 DOCREATE = .T.  CAPTION = "Form2" VISIBLE = .F.  NAME = "FORM2" AUTOCENTER=.T.

ADD OBJECT command1 AS COMMANDBUTTON WITH ; TOP = 192, ; LEFT = 48, ; HEIGHT = 25, ; WIDTH = 241, ; CAPTION = "Remove Me", ; NAME = "Command1"

PROCEDURE command1.CLICK THISFORM.HIDE THISFORMSET.FORMS[1].ENABLED=.T.     THISFORMSET.FORMS[1].SHOW THISFORMSET.REMOVEOBJECT(THISFORM.NAME) ENDPROC ENDDEFINE   From the command prompt, type the following: DO REMFRM  Click Add Form. Click Remove Me.</li></ol>

RESULT: A message box appears with the following error message:

Fatal error: Exception code = C0000005

After clicking OK in the error message box, Visual FoxPro terminates.

Keywords: kbbug kbfix kbcontainer kbctrl kbvs600sp3fix KB195273

-

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

© Microsoft Corporation. All rights reserved.