TabControl Constructor

Definition

Initializes a new instance of the TabControl class.

C#
public TabControl();

Examples

The following code example creates a TabControl with one TabPage. The TabControl constructor creates an instance of tabControl1.

C#
using System.Windows.Forms;

public class Form1 : Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;

    public void MyTabs()
    {
        // Invokes the TabControl() constructor to create the tabControl1 object.
        this.tabControl1 = new System.Windows.Forms.TabControl();

        // Creates a new tab page and adds it to the tab control
        this.tabPage1 = new TabPage();
                
        this.tabControl1.TabPages.Add(tabPage1);

        // Adds the tab control to the form
        this.Controls.Add(tabControl1);
    }

    public Form1()
    {
        MyTabs();
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10