Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Object from ActiveX
Message
From
05/02/1999 09:05:00
Paul Frost
Instem Computer Systems Ltd
Stone, United Kingdom
 
 
To
04/02/1999 17:06:44
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00183418
Message ID:
00184315
Views:
21
As far as I understand it CREATEOBJECT creates an independant object, whereas AddObject adds a new object to the current container, it is not necessary to create the object & then add it.

I have used a sequence similar to the follwoing to generate a form with an object :

NewForm = CREATEOBJECT( "Form" ) && creates the form
NewForm.AddObject( "NewObj", "MyClass" )
NewForm.NewObj.Name = "Name"
NewForm.Show()

The CREATEOBJECT creates the form itself, AddObject is used to put objects onto the form.

If you want the object to be 'attached' to the form, you would only use the AddObject method. Maybe the error is generated because you already have an object assigned to var & then assigning a new object to it.

I would also be concerned about creating objects with the same name as the class (add object oleMessage1 as oleMessage1), I would use different names, though maybe this is because of my background in C/Pascal.etc.

---------------
(PS I've used FoxPro 2.x quite a lot & I'm moderately new to VFP5.0, so I may be wrong here, if anyone wants to tell me so, feel free, I'm still learning too.)

Hope it helps,
Paul
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform