web container replacing

Hi there… I have a real problem…
I have a bunch of containers with controls on them. I want them to switch over from one to the other without refreshing the homepage.
I have dragged a container control onto the home page. It’s called “HomePageContainer”. It immediately becomes “HomepageContainer1”.

If I click a button on the webcontainer I can add my Editcontainer to the page by using

homepage.EditWindowChange

this goes to a method code in the Homepage like this

HomePageContainer1.Visible=False
Dim c As New EditContainer
c.LockRight = True
c.LockBottom = True
c.EmbedWithin(Self, 40, 100, c.Width, c.Height)

which puts the Editcontainer onto the homepage.
I’d rather that the Homepagecontainer gets removed completely.

Now switching back again is not working.
the debugger stops telling me that EditConatiner doesn’t exist - I guess rightly so.

I’ve tried “for each” … doesn’t work. Webcontainers are not arrayable.
There seems to be no way I can work out dynamically how to do this.

I’ve plowed the forum looking for a definitive answer to no avail.

Can somebody write a useful tutorial on adding webcontainers and switching between them painlessly?
Cheers,
Sean

Sean, just a detail, but if you could select the code and click the code icon above the editor, that would greatly improve readability.

HomePageContainer1.Visible=False Dim c As New EditContainer c.LockRight = True c.LockBottom = True c.EmbedWithin(Self, 40, 100, c.Width, c.Height)

What you should do, is to have an array of WebContainers, instead of Dimming :

myContainers.append New EditContainer

So you have a reference to access that container later. You can do a for each on the array and look at something specific to that container to fetch it, such as a title property you add to each and set for your needs to recognize the container later.

If none is of the same type, you can also check with

If myContainers(i) isa EditContainer then ...

If you store different kinds of containers in a WebContainers array, you will need to cast them for use later.

EditContainer(myContainers(1)).TextField1.Text = "Hello"

From what I understand from the language guide, you can’t make control sets out of webcontainers - which means no arrays/

You should read things more carefully

Control set <> Array.

Array <> Control set.

Well, if you have trouble wrapping your head around an array of WebContainers, you can still use a property per container. Don’t use Dim anymore.

BTW, you can also use a dictionary where you place each new container.