Microsoft KB Archive/148331

= PRB: Cannot Open Form That Has =CREATEOBJECT Property Value =

Article ID: 148331

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q148331



SYMPTOMS
If a form property is assigned the value =CREATEOBJECT with the WriteExpression method, the form can no longer be opened in the Form Designer. If an attempt is made to open the form, the error message "Data type is invalid for this property" is displayed and the Form Designer is not opened.



CAUSE
Although WriteExpression allows storing an object reference to a form property, this is not valid in Visual FoxPro.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
  Create a program that contains the following code: IF FILE('myform.scx') ERASE myform.scx ERASE myform.sct ENDIF CLEAR TYPEAHEAD KEYBOARD '{ALT+M}pmyprop{ENTER}' KEYBOARD '{ALT+F}cy' CREATE FORM myform MODIFY FORM myform NOWAIT =ASELOBJ(x,1) x(1).WRITEEXPRESSION('myprop',"=CREATEOBJECT('commandbutton')") CLEAR TYPEAHEAD KEYBOARD 'Y'  CLOSE ALL  Run the program. Try to open the Myform form in the Form Designer by choosing Open from the File menu. Select Form under Files of Type, and then select Myform. The message "Data type is invalid for this property" will be displayed and the Form Designer does not open.

NOTE: If =CREATEOBJECT is entered through the property sheet, the error message is displayed and the property is reset to its original value.

How to Repair the Form
If the form cannot be opened (as described in Step 3), you can repair it by using this procedure:

 Make a backup copy of the form's .scx and .sct files:

Copy file .scx to file .sbx

Copy file .sct to file .sbt

  Open the form's .scx file as a table by entering the following commands in the Command window: USE .scx BROWSE FIELDS properties FOR UPPER("(crea") $ UPPER(properties)                       </li>  Double-click the word Memo. Then find and remove the following line where PropertyName is the name of the property assigned the =CREATEOBJECT expression:       <PropertyName>=CREATEOBJECT NOTE: Do not change any other lines. Changing any other lines may render the form unusable. </li> Type a USE command in the Command window to close the .scx file. You should now be able to open the form in the Form Designer. If the form opens properly, you can delete the backup files created in Step 1.</li></ol>

Additional query words: VFoxWin

Keywords: KB148331

-

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

© Microsoft Corporation. All rights reserved.