Andrei Ion
Andrei Ion

Reputation: 1827

Dynamically adding pages in a Multipage control

I want do add some pages in a multipage when a Initialize the form. I did it with this code:

Me.Controls("main").Pages.Remove (Page1)
Me.Controls("main").Pages.Remove (Page1)
For Each pagini In ws1.Range("pagini")
    Me.Controls("main").Pages.Add (pagini)
    i=i+1
Next pagini

In the pagini range are the names of the captions for the pages. It works fine... it generates the pages with those names but now I want to dynamically add some other controls on everypage and I have a problem... I don't know the names of the pages. I tried to add the names in the code above but I get an error when I tried to compile

Me.Controls("main").Pages.Add ("test" &i,pagini)

So I want to add a name for every page added in that code but I don't know how.... after I add the name I want to add some other controls on each page but that's a different story and I hope I'll manage to do that! Thanks a lot!

Upvotes: 2

Views: 2428

Answers (1)

jonsca
jonsca

Reputation: 10381

You have access to the page count information, via Me.Controls("main").Pages.Count which is current after you've added the pagini.

Therefore, go to Me.Controls("main").Pages(Me.Controls("main").Pages.Count) and change whichever property you would like.

Upvotes: 2

Related Questions