I am using Infragistics 7.3 version UltraTabControl.
I have written the following code to add tabs and controls to the tabs at run-time. I am calling addTabs() function 4 times, this means I have to get 4 tabs added to tab control. But 8 tabs are get added to tab control.
{
InitializeComponent();
TextBox tx2 = new TextBox();
addTab(tx1);
addTab(tx2);
addTab(tx3);
addTab(tx4);
}
page.Controls.Add(control);
tab.TabPage=page;
Please Reply,
Thanks in advance.
Might I add that you want to do the above only after you've added the tabs to the tabControl
The Infragistics docs on UltraTabPageControl says that instances of these classes are created automatically for each UltraTab created. This might be why you are getting double the number of tabs. You probably can add your controls directly without instantiating a UltraTabPageControl:
ultraTab1.TabPage.Controls.Add(control);
Indika
Looks like you need to set the TabPage before adding it to the controls collection. Swap the lines for setting the tabpage and adding it to the controls collection as below: UltraTab tab = new UltraTab(); UltraTabPageControl page = new UltraTabPageControl(); page.Controls.Add(control);
tab.TabPage = page; this.ultraTabControl1.Controls.Add(page);
this.ultraTabControl1.Tabs.Add(tab);
Thanks for reply
If I remove the suggested line ,I get 4 tabs only.But the controls are not displayed in tab page.
I see that you add the UltraTabPageControl to ultraTabControl1 and then add the UltraTab control to ultraTabControl1 again. Try removing the following line.
this.ultraTabControl1.Controls.Add(page);