The TabControl control is a container control that allows you to display multiple tab on a single form and it allowed switching between the tabs.

How to use TabControl

Drag and drop TabControl from Toolbox on the window Form.

TabControl in C#.Net

 Change header text of TabPages

Example:
private void frmTabControl_Load(object sender,  EventArgs e)
{
      // Header text of TabPage1 will be chnage
      tabPage1.Text = "Email id";
      // Header text of TabPage2 will be chnage
      tabPage2.Text = "Language";
 }

When you run the project then Header Text of TabPages will be changed.

TabControl in C#.Net

Other control can be place in TabPages.

TabControl in C#.Net

When you click LangaugeTab then Language TabPage will open.

TabControl in C#.Net

Add tab pages in TabControl
Example:
private void frmTabControl_Load(object sender,  EventArgs e)
{
            // add new tab page in tabcontrol
            tabControl1.TabPages.Add("Database");
 }


When you execute the application then new TabPage will be add.

TabControl in C#.Net

New  TabPage  with name Database is added.

TabControl properties

ItemSize:  Gets or sets the size of the control's tabs. 

TabStop:  Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.

Visible:  Gets or sets a value indicating whether the control and all its child controls are displayed.

TabCount:  The number of tabs in the tab strip.


Leave Comment