Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one
i tried to add new tabpage to tabcontrol but the added page must be like first tabpage
i mine for example if tabpage1 has buttom and other object
the added tabpage (tabpage2) must have the same objects
like copy the first tabpage.
how can i do that .

thanks
Posted

You have a couple of options.

1) If each page has identical controls with identical behaviour, then take those controls off the TabControl completely.

2) If the controls are just similar, create a class derived from UserControl and put the shared controls and any variations into that. Then put a copy of your derived UserControl on each TabPage.

Nick
 
Share this answer
 
Use
Tabcontrolobj.TabPages.Insert(0,New TabPage());


This will insert your new tabpage on the first page.

Tabpage is not derived from ICloneable, so there is no Clone method. You need to copy each control into the new tabpage. Just loop throught this.Controls to find each control and copy each properties of those controls individually...

I think this is what you need, right?:thumbsup:
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900