Export (0) Print
Expand All

How to: Add and Remove Tabs with the Windows Forms TabControl

By default, a TabControl control contains two TabPage controls. You can access these tabs through the TabPages property.

To add a tab programmatically

  • Use the Add method of the TabPages property.

    string title = "TabPage " + (tabControl1.TabCount + 1).ToString();
    TabPage myTabPage = new TabPage(title);

To remove a tab programmatically

  • To remove selected tabs, use the Remove method of the TabPages property.


  • To remove all tabs, use the Clear method of the TabPages property.

    // Removes the selected tab:
    // Removes all the tabs:
© 2014 Microsoft