Why can't I make a Control Set of a Container Control?

Why?

Because its not allowed :slight_smile:
As for why its not allowed well … I’m sure if you search my old posts in the forums you’ll find a long explanation :slight_smile:

Lets just say control sets were a way to allow dynamic creation of controls that normally you could not
Containers have always been able to be dynamically created

Brian - if you create an array (type container control) then you can manage each element (container) as you wish. even better if you subclass Container Control and then add a myIndex index to track your specific container for example.

// Rough code

Var thisContainerArr() as mySubClassedContainerControl

Var thisNewContainer as New mySubClassedContainerControl

thisContainerArr.append (thisNewContainer)
thisContainerArr(thisContainerArray.Ubound).myIndex = xxx

I can add more detail if you wish and when I get back to a computer :slight_smile:

Mike Thanks for the answer… I got the idea the moment you said to subclass container control itself! :slight_smile:

[quote=481397:@Mike Cotrone]Brian - if you create an array (type container control) then you can manage each element (container) as you wish. even better if you subclass Container Control and then add a myIndex index to track your specific container for example.

// Rough code

Var thisContainerArr() as mySubClassedContainerControl

Var thisNewContainer as New mySubClassedContainerControl

thisContainerArr.append (thisNewContainer)
thisContainerArr(thisContainerArray.Ubound).myIndex = xxx

I can add more detail if you wish and when I get back to a computer :)[/quote]

How do you make a container control set on the ide of this?

You don’t. ContainerControl can be embedded into a window without a control set. To maintain references to the controls you create, you store the array as a property rather than a local variable. So instead of creating a control set in the IDE, create an array property for the ContainerControl subclass.

Correct but then you have to Embedwithin remove link events etc etc… it’s more work and I think I’m error prone with this method.

add 2 methods to your window to add a new one and close/remove one
write that code once - get it right once

reuse the heck out of it :slight_smile:

If you want to add them to the window in the IDE, put code in the open event of your container subclass that adds itself to the array and sets its index value. Eg.,

thisContainerArr.Append(me)
myIndex = thisContainerArr.Ubound