Files
docs-desktop/dotnet-desktop-guide/framework/winforms/controls/how-to-add-and-remove-tabs-with-the-windows-forms-tabcontrol.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.9 KiB

title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title description ms.date dev_langs helpviewer_keywords ms.assetid
Add and Remove Tabs with TabControl Learn how to add and remove tabs with the Windows Forms TabControl control, which contains two TabPage controls. Access these tabs through the TabPages property. 03/30/2017
csharp
vb
cpp
tabs [Windows Forms], removing from pages
TabPage control
TabControl control [Windows Forms], adding and removing tabs
tabs [Windows Forms], adding to pages
tab pages
66d4dfca-41e8-44e3-9c80-fb7ac4cb1619

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

By default, a xref:System.Windows.Forms.TabControl control contains two xref:System.Windows.Forms.TabPage controls. You can access these tabs through the xref:System.Windows.Forms.TabControl.TabPages%2A property.

To add a tab programmatically

  • Use the xref:System.Windows.Forms.TabControl.TabPageCollection.Add%2A method of the xref:System.Windows.Forms.TabControl.TabPages%2A property.

    Dim myTabPage As New TabPage()  
    myTabPage.Text = "TabPage" & (TabControl1.TabPages.Count + 1)  
    TabControl1.TabPages.Add(myTabPage)  
    
    string title = "TabPage " + (tabControl1.TabCount + 1).ToString();  
    TabPage myTabPage = new TabPage(title);  
    tabControl1.TabPages.Add(myTabPage);  
    
    String^ title = String::Concat("TabPage ",  
       (tabControl1->TabCount + 1).ToString());  
    TabPage^ myTabPage = gcnew TabPage(title);  
    tabControl1->TabPages->Add(myTabPage);  
    

To remove a tab programmatically

See also