Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to know if it is possible to create multiple tabPages(with same added controls in all tabPages) within the same tabControl?
My first tabPage contains a label, textBox, button and a listView. And i want that all of my controls in this tab is made available when the user clicks to create a new tabPage.
Posted
Comments
Rob Philpott 30-Apr-14 8:14am    
Do you mean exactly the same instances on each tab page, or just that each tab page has the same layout and controls on it?
sovit agarwal 30-Apr-14 8:22am    
I dont understand the difference between the two.
But, i want is that when i click to create a new tabPage on a tabControl,the new tabPage must have the same controls as it was on the previous tab.
gggustafson 30-Apr-14 8:53am    
Yes you can. The contents of one TabPage within a TabControl are distinct from the contents of another TabPage in the same TabControl. The problem is in naming the controls so that there is no conflict. You cannot have TabPage1 and TabPage2 contain a Button named button1. So as you create the new TabPage, you need to insure that there are no name conflicts. So TabPage1 contains button1 and TabPage2 contains button2

I question a design that has this requirement. If two TabPages have the same contents, why have two TabPages in the first place.
ZurdoDev 30-Apr-14 12:41pm    
This looks like a solution to me.
gggustafson 22-May-14 14:20pm    
Are you going to rate my solution?

1 solution

The contents of one TabPage within a TabControl are distinct from the contents of another TabPage in the same TabControl. The problem is in naming the controls so that there is no conflict. You cannot have TabPage1 and TabPage2 contain Buttons named button1. So as you create the new TabPage, you need to insure that there are no name conflicts. So TabPage1 contains button1 and TabPage2 contains button2

I question a UI design that has this requirement. If two TabPages have the same contents, why have two TabPages in the first place?
 
Share this answer
 
Comments
ZurdoDev 30-Apr-14 15:54pm    
+5. Good explanation.

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