#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Roswell, NM
    Posts
    6
    Rep Power
    0

    How to Select Tabs in Tabcontrol


    Hi,

    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

    ssTab.Tab(1).Select

    But the structure has changed somewhat with VB.net.

    Would appreciate a hand.

    Thanks
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Roswell, NM
    Posts
    6
    Rep Power
    0
    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
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Talking tabcontrol


    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)
    End If
    If TabControl.SelectedTab Is TabPage2 Then
    MsgBox("this is page two", MsgBoxStyle.Information)
    End If
    End Sub
    End Class

IMN logo majestic logo threadwatch logo seochat tools logo