Information générale
Catégorie:
Contrôles ActiveX en VFP
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement