>As Vlad pointed out, it's NewObject() you want since the extra parms for AddObject are the ones passed to the Init() of the object added (unless the object is an ole control).
>
>I wanted to point out that if you want to do both - i.e., add an object by specifying the source file AND pass parameters, NewObject also has the
cInApplication parameter that must be delineated. It can be empty, but it has to be delineated. It is not ignored.
>AddObject() does have the OLE class parameter before the init parameters, but it is ignored if the object isn't an OLE control.
>
>e.g. say you have textbox that you can pass in the name of the font to use.
>
>Using AddObject:
>
>Set Classlib To myclasslib
>thisform.AddObject("txtNew", "mytextbox", "Courier New")
>Using NewObject:
>
>thisform.NewObject("txtNew", "mytextbox", "myclasslib", , "Courier New")
Trey,
I don't want to pick on you, but you can not just omit the parameter for some reason. You should use an empty string, otherwise you'll get an error. At least in VFP6.0 SP4 I got an error, as I recall.
>
>>I tried putting in a third param as _cc.vcx for classlib and got no lparameter statement found.
>>
>>>>In putting a checkbox in a grid column with code, just curious why the docs show 3 or 4 params and the method of the column object has two params, so must you use two? What if you don't want to use a baseclass?
>>>>
>>>>
>>>>TIA
>>>
>>>It will work with the extra params, just like the function.
>>>I guess they don't come up when in the code window because they are 'virtual parameters' that are handled under the hood.
If it's not broken, fix it until it is.
My Blog