Dynamic ContainerControl: dynamic add label

Novice programmer in Xojo… Some experiments with ContainerContol…

I dynamically create a label:

dim la as new label

I dynamically create a containercontrol:

dim tc as new ContainerControl
tc.Enabled = true
tc.visible = true

How can I dynamically add the label la to the container tc?

Desktop Control Sets

Maurizio, thank You for your reply! Control Sets seem very strange to me : “Window already contains a control of the type you wish to create… the existing control is used as a template…”

That’s because you don’t want a control set for what you are trying to do. You can’t create interface controls, control sets are the only way to use “dim x as new thing” for interface controls, but even then your original code can not work.

I had posted, but when I tried to quote it for Maurizio, I hit the delete button. Unfortunately, because of this forum software configuration (it didn’t behave like this previously, and I’m not happy about the change), you lost out on some valuable information.

You should describe for us what you’re trying to achieve, but from the user’s perspective. The community can then help guide you through what technologies you may need.

The rationale behind a controlset is that only already existing controls can be dynamically created and added to a window or container.
This isn’t a strangeness because usually an application often needs to create dynamically more than one control so these controls are grouped in a container control where layout is already defined.
Adding a single control can be done but a better way is to use a container control.