vb.net tabpage copying dynamic

  • Thread starter Thread starter marfi95
  • Start date Start date
M

marfi95

Hi all,

I have an app that contains a tab control with a tabpage on it. As
part of the interface, the user keys in a field that basically
identifies how many instances of these tabpages to have. So my basic
question is how can I make copy of a tabpage dynamically so when the
user says they want 3 occurrences, I add two new pages with all the
same controls dynamically. The new pages should have exactly all the
same controls as the original page, but the values within the fields
will be populated differently based on my database.

Thanks,
Mark
 
Marfi,

The tabpage in version 1x has some unwanted behaviour therefore I show
everybody almost forever with a tabpage this link.

http://dotnetrix.co.uk/tabcontrols.html

It seems simple that you only need to copy all controls from tabpage1 to
tabpage2 however that is not true because that creates a shallow copy. (It
are the same controls)

Probably the best way to go is to create from your TabPage your own
controlclass by inheriting the TabPage class. Fill this and use that on your
tabpage.

http://msdn.microsoft.com/library/d...rfsystemwindowsformsusercontrolclasstopic.asp

I would try to inherit tabpage instead of usercontrol

I hope this helps,

Cor
 
Thanks. You wouldn't by any chance have a small example of doing
something like this would you ?
 
I suppose one way I could do it is to impose a maximum for the user
(shouldn't be a problem for the user) and create that many on the form,
but hide/show them as needed. If I did this, then the controls would
have to have different names on each of the pages ? That would make it
more complex knowing which version of the control name to use to
populate (unless I can use dynamic names and tie the control name to
the page index or something like that). It would be nice to have
something like a control array across the pages ? Any way of doing
something like that or is there an easy way.
 
Thanks. You wouldn't by any chance have a small example of doing
something like this would you ?

Marfi, there is enough done about that it would be easy to find, search for
usercontrol,

Is it not on Micks website?

There is so much on that pages about the tabpage.

Cor
 
Cor,

Yea, saw something similar. Curious about what you thought about my
last response where the pages would be hidden/shown when needed.

Not sure though how to address the controls in the code related to
which page the user is on and have a common set of code.

M
 
Marfi,
Yea, saw something similar. Curious about what you thought about my
last response where the pages would be hidden/shown when needed.

Not sure though how to address the controls in the code related to
which page the user is on and have a common set of code.
The best sample for that is on the pages from Mick, that is why I know that
website. He has made a kind of total solution for that. (There is a bug in
1.x therefore you have to do something more).

Cor
 
Back
Top