Praveen Dinks
Praveen Dinks

Reputation: 21

Using tab controls

I have a tab control which contains a set of controls like list boxes,buttons and a chart control. Is there a possibility of adding another tab, making the new tab to comprise of all the controls that the first tab contained.?

Upvotes: 0

Views: 665

Answers (1)

VladL
VladL

Reputation: 13033

Based on your comment you are better to create a usercontrol. After creating it once, you can simply add it to the new tab like this:

TabPage tp = new TabPage("new tp");

MyUserControl muc = new MyUserControl();
tp.Controls.Add(muc);

tabControl1.TabPages.Add(tp);

int tabIndex = 1;

You can access the properties of each tab like this:

int tabIndex = 1;
MyUserControl contr = tabControl1.TabPages[tabIndex].Controls[0] as MyUserControl;
contr.MyGraph = ...

Upvotes: 1

Related Questions