0

Hi guys,

How I could get the controls of tab controls, here's a sample code

public void AddTabPage() {

            tabCounter = tab.TabCount;
            
            if (tabCounter == 0)
            {
                TabPage page = new TabPage("New Doc " + 1);
                //CurrentTabPageName = "New Doc " + 1;
               [U][U] RichTextBox txt = new RichTextBox();[/U][/U]
                txt.Dock = DockStyle.Fill;                
                page.Controls.Add(txt);
                tab.TabPages.Add(page);
                tabCounter++;
            }
            else {
                tabCounter++;
                TabPage page = new TabPage("New Doc " + tabCounter);
               // CurrentTabPageName = "New Doc " + tabCounter;
         [U][U]RichTextBox txt = new RichTextBox();[/U][/U]
                txt.Dock = DockStyle.Fill;
                page.Controls.Add(txt);
                tab.TabPages.Add(page);                
            }
        }

here's I created richTextBox object on the runtime, how I could access this object from tabcontrol???

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

Find by a key,

TabPage page = new TabPage("New Doc " + 1);
//CurrentTabPageName = "New Doc " + 1;
RichTextBox txt = new RichTextBox();
txt.Name="Item1";
txt.Dock = DockStyle.Fill;                
page.Controls.Add(txt);
tab.TabPages.Add(page);
Control  []t = tabControl1.Controls.Find("Item1", true);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.