leosco

leosco

  • NA
  • 13
  • 0

Tabcontrol controls gone when new tab added

Sep 27 2010 8:03 AM

Hi, I'm making a tabcontrol that programatically adds a textbox to each tab. The following code I used works, but the problem with it is that every time a new tab page is created, the textbox is missing from the previous tab pages. Why and how can I fix that?
TextBox tb = new TextBox();
TabPage Tab = new TabPage();
tb.Dock = DockStyle.Fill;
Tabs.TabPages.Add("Untitled.asm");
Tabs.TabPages[Tabs.TabCount - 1].Controls.Add(tb);
Tabs.SelectedIndex = Tabs.TabCount - 1;



Answers (1)