>I has an OCX and I wonder if I can use addobject to add teh OCX?
>
>lo = createobject('mycom.com')
>
>can perform the following?
>lo = create('form')
>lo.addobject(mycom.com)
>
AddObject requires two string parameters - the name to be associated with the newly-created object on the form, and the name of the class to instantiate.
lo.AddObject('MyCOMInstance','mycom.com')
would add an instance of mycom.com to the Form instance stored in lo which would then be referenced as lo.MyCOMInstance.
method or property reference when needed.
Some ActiveX controls cannot be added directly to a form, and may require that you create an instance of the OLEControl class to serve as a wrapper on the object. Trying to do so gets the result 'Object class is invlaid for this container'. When this happens, you have two choices - create a subclass of the OLEControl class to wrap the ActiveX control, or use AddProperty to create a member property for the Form, and then create an instance of the ActiveX control via CREATEOBJ() and assign it to the member property.