I have TabControl
and 4 TabPages
. I need to select the second Tab programmatically!
You can use the method SelectTab . Show activity on this post. 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).
The Windows Forms TabControl displays multiple tabs, like dividers in a notebook or labels in a set of folders in a filing cabinet. The tabs can contain pictures and other controls. Use the TabControl to create property pages.
You have two ways to do it
SelectedTab:
MyTabControl.SelectedTab = MyTabPage
(The TabPage you want to select)
SelectedIndex:
MyTabControl.SelectedIndex = 1
(1 is the index of the second TabPage)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With