>You need to use NewObject or AddObject, not CreateObject.
>
>NewObject method is used to add new form's controls to the form.
>
>CreateObject is used when you need to create a reference to some object. With visual objects (with the exception of forms) in 99% of cases you use NewObject.
To further clarify this, there's a NewObject() function, and the .NewObject() method. The functions create a standalone object to which you get a reference, and that's it. Such an object is initially invisible and has no parent. You can set it visible once you've set all the properties you wanted, but you can't give it a parent.
OTOH, objects which can have members have the .addobject() and .newobject() methods which create _member_ objects, and the creator object is the parent to its members, which is the crucial difference.