February 17th, 2004, 02:28 PM
How to Select Tabs in Tabcontrol
For the life of me I can't figure this out yet.
How do we select tabs in the ssTabcontrol now?
In VB6, it used to be something like
But the structure has changed somewhat with VB.net.
Would appreciate a hand.
February 17th, 2004, 03:13 PM
Figured it out.
Each tab in the tab control has a name that is set in the tabcontrol.tabpages property box.
For me, tab one was named "t1" and tab two was named "t2"
So the correct context would be
tabcontrol.selectedtab = t1 ' for tab one
tabcontrol.selectedtab = t2 ' for tab two
January 18th, 2012, 12:27 PM
This gave me an idea but gave me an error, so I tried using Is instead of the '=' and it worked, you may test it on a button outside the tabcontrol that you are using
Originally Posted by Rougy
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TabControl.SelectedTab Is TabPage1 Then
MsgBox("this is page one", MsgBoxStyle.Information)
If TabControl.SelectedTab Is TabPage2 Then
MsgBox("this is page two", MsgBoxStyle.Information)