I need some help please, what I am wanting to do is to create command buttons dynamically at run time using the CreateObject method.

I know you can create other buttons and controls by using a control index and loading the next index, but I am wanting to know if you can directly use the CreateObject method.

Now I have created a command button object, however is does not have all the methods and properties available to it as a button made in the editor. I have done this by doing something like:
Dim b as Object
Set b = CreateObject("Forms.CommandButton.1")

However, now I am stuck, how do I get this to display on the form and assign events and change the properties of the button?

Now I think what is happening is when you create a command button in the VB editor MS automatically wraps the class into a usercontrol so creating an ActiveX control that the class is contained in. I think this is the case as looking at the class it has a picture property that you can assign the button.bmp to it, therefore giving it the appearance of a cmdbutton.

So after all of that what I want to know is I am correct in my thinking and if so can I replicate what MS do in the Visual Editor, or I am better off just putting a command button into an ActiveX control myself and then use that as the creation object??


Thanks in advance
Lee