Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
loop throught ultratab pages and find control
posted

Hello

How 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

Parents
  • 34810
    Offline posted

    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.

Reply Children
No Data