FIX: Private Data Session and Rich Text Control Cause Error Message (255572)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0

This article was previously published under Q255572

SYMPTOMS

A form contains the ActiveX Rich Text control, a private Data Session, and has ActiveX dual interface support disabled (this is the default setting in Visual FoxPro 6.0). After pressing the ENTER key in the Rich Text control, the following error appears and Visual FoxPro closes:
Fatal error: Exception code: C0000005

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

Do one of the following to work around this problem:
  • Change the private Data Session to the default Data Session. In the code example below, comment this line:
    DataSession = 2  
    						
    and uncomment this line:
    * DataSession = 1
    						
  • Enable ActiveX dual interface support by commenting this line:
     sys(2333,0)
    						
    and uncommenting this line:
    * sys(2333,1)
    						

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Visual FoxPro for Windows 7.0 Service Pack 1.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a program that contains the following code and run it:
    CLOSE DATA ALL
    CLEAR ALL
    SYS(2333,0)
    *SYS(2333,1)
    
    PUBL ox
    ox = CREATEOBJECT('form1')
    ox.ADDOBJECT('IL1', 'olecontrol', 'RICHTEXT.Richtextctrl.1')
    ox.il1.CONTROLSOURCE = "ctemp.m1"
    ox.il1.HEIGHT = 100
    ox.il1.VISIBLE = .T.
    ox.SHOW
    
    DEFINE CLASS form1 AS FORM
        DATASESSION = 2
        * DATASESSION = 1
        PROCEDURE LOAD
        CREATE CURSOR ctemp (m1 m)
        INSERT INTO ctemp VALUES ("this is a test")
    ENDPROC
        PROCEDURE UNLOAD
        CLOSE DATA ALL
    ENDPROC
    ENDDEFINE
    					
  2. Place the cursor at the end of the line in the Rich Text control box.
  3. Press ENTER. The error in the "Symptoms" section appears and Visual FoxPro closes. The behavior also happens in Visual FoxPro 6.0 with Service Pack 3 installed. This behavior does not occur in Visual FoxPro 5.0 because the ControlSource property is not exposed.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbCodeSnippet kbCtrl kbDSupport KB255572