How To Use the Object Property to Reference Methods/PropertiesLast reviewed: January 20, 1997Article ID: Q156548 |
The information in this article applies to:
SUMMARYA new Application property has been added to all objects in Visual FoxPro version 5.0. This includes both the OLE Bound control and the OLE Container control. If you have OLE Automation code that does not use the Object property (.object) to reference the various properties and methods of the object, a conflict occurs between the Visual FoxPro Application property and the Application property of the OLE object.
MORE INFORMATIONIf you have OLE Automation code in which you have not used the Object property (.object) to reference the properties and methods of the OLE object, then Visual FoxPro 5.0 assumes the references are for the Visual FoxPro Application object properties and methods. For example, create an OLE object with the following commands:
PUBLIC frmMyForm frmMyForm = CREATEOBJECT("form") frmMyForm.AddObject("oleTest","OLEControl","Excel.Chart")Now enter the following command:
WAIT WINDOW frmMyForm.oleTest.Application.NameThe message that appears is "Microsoft Visual FoxPro" in Visual FoxPro version 5.0 and "Microsoft Excel" in Visual FoxPro version 3.x. If you use the following Quit method:
frmMyForm.oleTest.application.quitVisual FoxPro version 5.0 calls the Quit method of Visual FoxPro, instead of the Quit method of the OLE object as in Visual FoxPro version 3.x. In order to reference the properties and methods of the OLE object, you need to update your code to use the Object property as in the following line of code:
WAIT WINDOW frmMyForm.oleTest.Object.Application.Name frmMyForm.oleTest.Object.Application.Quit REFERENCESVisual FoxPro 5.0 Help; search on "Application property" NOTE: This help topic incorrectly lists only Application Object and _VFP System Variable in the applies to list. This property is exposed to all Visual FoxPro base classes.
|
KBCategory: kbprg kbhowto
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |