Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add object from define class?
Message
From
04/08/2003 01:18:03
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
To
03/08/2003 22:48:18
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00816367
Message ID:
00816375
Views:
17
What "error" are you getting ?

The problems I see here is that you have an extra space in "oleExcelObject ", and you need to add Visible = .T. to your OLEControl (or do a THISFORM.Excel.Visible = .T. after your .AddObject) in order to have the Excel sheet show up on you form.

Putting .AddObject in .Init is fine.

Otherwise it should work.

Are you trying to put the DEFINE CLASS in the Form's .Init event ? If that's what you're doing, that's your problem: you have to put a DEFINE CLASS in a separate .PRG file (if you are using an .SCX/VCX based Form) and then add it to the Form using .NewObject which allows you to specify where your class is stored.

>Hi everybody!
>When I run a form and I would like add an object from the class that is defined programmatically with codes following:
>
>DEFINE CLASS oleExcelObject as OLEControl
> OleClass ="Excel.Sheet" && Server name
> DocumentFile = "test.xls" && This file must exist
>ENDDEFINE
>thisform.AddObject("Excel", "oleExcelObject ")
>
>
>I set these codes in init method or another method , I get an error.
>How to add object from define class when the form runtime?
>Please help me.
>Thanks
>Canh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform