January 18th, 2012, 01:27 PM
Join Date: Jan 2012
Time spent in forums: 23 m 36 sec
Reputation Power: 0
Originally Posted by Rougy
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
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
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)