I am using TabControl in a .NET application. By default, the first tab page of TabControl is showing in form loading. I want to show other tab pages in form loading. Programmatically, how can I show a different tab page?
5 Answers
tabControl1.SelectedTab = MyTab;
or
tabControl1.SelectedTab = tabControl1.TabPages["tabName"];
Where tabName
is the Name of the tab you want to activate (tabName
is NOT the text display).

- 2,684
- 2
- 16
- 29

- 5,474
- 6
- 36
- 48
-
12Alternatively, you may also use: **tabControl1.Select("NameOfTabToActivate");** – Oct 13 '10 at 06:26
-
2I have also used tabControl1.SelectedIndex = 0; – Owen Ivory Jun 02 '17 at 17:46
-
Why is this not a property on the Property window in the designer ? That does not makes any sense, one should be able to set this in the designer not only by code. – GuidoG May 24 '22 at 13:15
There are two properties in a TabControl control that manages which tab page is selected.
SelectedIndex which offer the possibility to select it by index (an integer starting from 0 to the number of tabs you have minus one).
SelectedTab which offer the possibility to selected the tab object itself to select.
Setting either of these property will change the currently displayed tab.
Alternatively you can also use the Select method. It comes in three flavour, one where you pass the index of the tab, another the TabPage object itself and the last one a string representing the tab's name.
For Windows Smart device (compact frame work ) (MC75-Motorola devices)
mytabControl.SelectedIndex = 1

- 1,039
- 18
- 42
Use SelectTab
like this:
TabPage t = tabControl1.TabPages[2];
tabControl1.SelectTab(t); //go to tab
Use SelectedTab
like this:
TabPage t = tabControl1.TabPages[2];
tabControl1.SelectedTab = t; //go to tab

- 645
- 5
- 11

- 1,542
- 15
- 15