?
Solved

how can i generate tab pages dynamically through coding in my C#.net window application ??

Posted on 2011-02-23
6
Medium Priority
?
268 Views
Last Modified: 2012-06-21
i want to generate tab pages dynamically through coding in my tabcontrol , but how can i do this ?
here i attach one snapshot in which 3 tabpages i created statically ,but i want to do it dynamically , but how can i do this ??



23-02-2011-6-22-18-PM.jpg
0
Comment
Question by:Parth48
  • 3
  • 2
6 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34960359
YourTabControl.TabPages.Add("A dynamic tab");

Open in new window

0
 
LVL 1

Accepted Solution

by:
milanjaric earned 2000 total points
ID: 34960560
tabControl.SuspendLayout();
// docking panel
Panel panel = new Panel();
panel.Dock = DockStyle.Fill;
panel.Controls.Add(new SomeUserControl());
// new Tab
TabPage tabPage = new TabPage("Tab title");
            
// add controls to their parents
tabPage.Controls.Add(panel);
tabControl.TabPages.Add(tabPage);

tabControl1.ResumeLayout();

Open in new window

0
 

Author Comment

by:Parth48
ID: 34967673
hi @milanjaric: u r right ...

but in your coding

panel.Controls.Add(new SomeUserControl());

where i can add someusercontrol , or i have to create user control for it ??
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 

Author Comment

by:Parth48
ID: 34968837
how can i dynamically add usecontrols to created tabpage ???

give me some suggestions ....
0
 
LVL 1

Expert Comment

by:milanjaric
ID: 34969049
where i can add someusercontrol , or i have to create user control for it ??
The answer is YES you need to create one if you did not have already

how can i dynamically add usecontrols to created tabpage ???
Look at my example above.
0
 

Author Comment

by:Parth48
ID: 34977425
hi @milanjaric: Thanks ...

it's working ...
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question