How to make a label child of a rectangle

Hi, I try to build a control from serveral other controls by instantanciating them from classes.
I have a class from rectangle and a class from label. Now it need to glue them together by making the label instance child of the rectangle instance.
Therefor I think I need the parent property of rectcontrol (Documentation says “aRectControl.Parent = newControlValue”)
but I don’t know how I can express newControlValue correctly.

Dont do this this way
You’ll have very little success - eps trying to handle events etc

You can subclass & create this entirely in the IDE using the visual designer

If it’s just a label and a rectangle, I would go so far as to use a Canvas instead of multiple controls.

oh yes, such a composed control made in the IDE works very well. Now I’m looking for a way to clone it.

The way to build it form a canvas class I used in an other application successfully but I tried to avoid all that work to calculate the text wrapping with different text size

And finaly I would like to know what to use for “newControlValue”

Use a ContainerControl to create your new control with your rectangle and label inside. You will then be able to instanciate it at will.

I intend to move around the clones with the mouse and I’m not sure wether it’s possible to change the left and top of a container control when the application is running.
What about a group box?

ContainerControl is a control. You can move it just like any other control.

[quote=302761:@Christian Hahn]I intend to move around the clones with the mouse and I’m not sure wether it’s possible to change the left and top of a container control when the application is running.
[/quote]
Certainly
Otherwise we’d never have been able to make the IDE which has many many many container controls

Short answer: you can’t do it that way. Use a ContainerControl or a Control Set.

Thank you all for your tips, it took a while to try them out.
The most easy way is to use a groupbox since it’s an ordinary control with an index property.
The containercontrol has more options of course and it’s to be moved fine what I not expected first.
But I still wonder how to address a particular instance of a class derived from containercontrol.
The attempt:
Dim c As Control
For i As Integer = 0 To Self.ControlCount-1
c = Window.Control(i)
If c IsA ContainerControl Then

must fail since the containercontrol isn’t a control.
Anywhere I read to use a own variable of the class but I got no idea of that.
I would be grateful for some hints.

ContainerControl is an EmbeddedWindowControl.

You need to maintain your own list of them in an array. You cannot (easily) get them from the window control() function.

…of them in an array. …
Do you mean an array of instances of the class?
So I could say: myArray(1).left = 100
I’ll try it out.

Thank you very much, to store the instanceses of the containercontrols in an array realy works fine.