Dynamically add controls to dynamically added tab

Here’s the scenario I’ve got…

button1 (on tab1)
button2 (on window1)

Also button1 is in a Control Set (Member Of btnok).

When I click on button2, I see…


And when I click on button3…

I can create another tab on tabpanel1, but I simply can’t work out how to dynamically add controls to that tab.

I’m thinking the code (for button3) goes something like this…

dim anotherbutton as RectControl = new window1.tabpanel1.tab1.btnok
anotherbutton.Top = 100
anotherbutton.Height = 100
PushButton(anotherbutton).Visible = True

But this code doesn’t work. In fact nothing I’ve tried works.

So if you someone can help me out that would be much appreciated.


have a look at containercontrol and .EmbedWithinPanel

TabPanel1.AddPanel("New Tab")
Var cc As New ContainerControl1
cc.EmbedWithinPanel(TabPanel1, TabPanel1.LastAddedPanelIndex,0,32,320,320)

i think this misbehave came from the use of native controls.
i wish all ui controls are more handier → OOP.

Ok, I’ve got it working now, thanks for taking a look at my problem and helping me out Markus.

1 Like