Swapping ContainerControls

So if I want to use containers to hold different screens of UI elements, what’s the best way to switch back and forth between them?

It seems closing the old container and embedding the new won’t work, as embedding can’t be done more than once.

I tried setting a window property of currentControl to my first container. Then I embedded that in my window, and then to make the switch:

currentControl = container2
currentControl.Invalidate

But no luck…

Switch the containers visibility property?
container1.visible = False
container2.visible = True

You could use a pagepanel and put the containers on separate pages then use

PagePanelName.Value = 0 to see the first 1

and PagePanelName.Value = 1 to see the next, etc. ?

Ah, good ideas! Thank you!

And what about calling a container’s method? I defined a “sayHi” method in one of my ContainerControls, but the compiler says it doesn’t exist.

Make sure you’re using the name of the instance of the container, not the container definition.

That was it, great catch!

[quote=112275:@Matthew Combatti]You could use a pagepanel and put the containers on separate pages then use

PagePanelName.Value = 0 to see the first 1

and PagePanelName.Value = 1 to see the next, etc. ?[/quote]

I always use Pagepanel for this. No need to create a container for each , just put all the controls in the Pagepanel.

Yeah, that’s how I started, but the project had gotten too complex to manage effectively without breaking it down.

I had the problem with so many controls that some would bled(?) thru, making it hard to move then around.