Question

How do I change the tabpage being displayed in my tabcontrol programmatically?

Was it helpful?

Solution

Either by tabControl1.SelectedIndex which is an integer or if you have a reference to a particular tab, tabControl1.SelectedTab.

If you wanted the first one selected:

tabControl1.SelectedIndex = 0;

OTHER TIPS

Other alternatives to the accepted answer:

tabControl1.SelectedTab = MyTabPage;

or tabControl1.SelectTab("NameOfTabToActivate");

or tabControl1.SelectTab(IndexOfTab);

or tabControl1.SelectTab(TabObject);

(I stole this answer from this post: Activate tabpage of TabControl)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top