HelloHow to add pages dynamically and in each page add a text box then loop through all the tabs and test in each page if there is a textbox and set the . text property of each different text box I hope my explanations are clear? thanks
Hello Olivier,
In order to add tabs and pages dynamically, you can invoke the Add method on the Tabs collection of your UltraTabControl like so:
ultraTabControl1.Tabs.Add("KeyOfNewTab" + tabCount, "Display Text for Tab " + tabCount);
This will return a new UltraTab item, which exposes a TabPage property that you can assign an UltraTabPageControl. The Controls collection of the UltraTabPageControl is where you can place the elements that you wish to be on the page when you select the corresponding UltraTab.
Regarding looping through each tab and setting the text of a TextBox, assuming that the TextBox is in the root of the Controls collection and is not a child control of another element that you have in your UltraTabPageControl, the following code should work for you:
foreach(UltraTab tab in ultraTabControl1.Tabs) { foreach(Control control in tab.TabPage.Controls) { if(control is TextBox) { TextBox text = control as TextBox; text.Text = "This is some text!!"; } } }
Please let me know if you have any other questions or concerns on this matter.
Hellothat's OKit works well
here's my VB code
For Each tab As UltraTab In ultraTabControl1.Tabs For Each c As Control In tab.TabPage.Controls If TypeOf c Is MyUserControl Then CType(c, MyUserControl).text = Now() End If Next Next
thanksolviier