I have created a tab in the designer and would like to add this tab each time a button is clicked with some different data in it.
When I run the following code:
this.tabsData.TabPages.Add("tabDatabaseTables", databaseName);
A tab is added, but the controls set in that tab do not appear.
I would like the controls to also appear.
If you need to duplicate the TabPage, the easiest path is to create a UserControl and just dock fill it into a new TabPage:
TabPage tabPage = new TabPage() { Text = "New Tab" };
tabPage.Controls.Add(new MyUserControl() { Dock = DockStyle.Fill });
tabControl1.TabPages.Add(tabPage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With