mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* 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
2.9 KiB
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 |
|
|
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
-
To remove selected tabs, use the xref:System.Windows.Forms.TabControl.TabPageCollection.Remove%2A method of the xref:System.Windows.Forms.TabControl.TabPages%2A property.
-or-
-
To remove all tabs, use the xref:System.Windows.Forms.TabControl.TabPageCollection.Clear%2A method of the xref:System.Windows.Forms.TabControl.TabPages%2A property.
' Removes the selected tab: TabControl1.TabPages.Remove(TabControl1.SelectedTab) ' Removes all the tabs: TabControl1.TabPages.Clear()// Removes the selected tab: tabControl1.TabPages.Remove(tabControl1.SelectedTab); // Removes all the tabs: tabControl1.TabPages.Clear();// Removes the selected tab: tabControl1->TabPages->Remove(tabControl1->SelectedTab); // Removes all the tabs: tabControl1->TabPages->Clear();