Solved

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

Posted on 2011-02-23
6
246 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 500 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now