|
|
Title | Programmatically select a tab in a TabStrip |
Keywords | tab, tab strip, tabstrip, select tab |
Categories | Controls |
|
|
Set the TabStrip's SelectedItem property to one of its Tab objects.
|
|
' Note that the TabStrip numbers tabs starting
' with 1 not 0.
' The index of the selected frame.
Private SelectedTab As Integer
Private Sub Form_Load()
Dim i As Integer
' Move all the frames to the same position
' and make them all invisible.
For i = 1 To ChoiceFrame.UBound
ChoiceFrame(i).Move _
ChoiceFrame(0).Left, _
ChoiceFrame(0).Top, _
ChoiceFrame(0).Width, _
ChoiceFrame(0).Height
ChoiceFrame(i).Visible = False
Next i
' Select the first tab.
SelectedTab = 1
TabStrip1.SelectedItem = TabStrip1.Tabs(SelectedTab)
ChoiceFrame(SelectedTab - 1).Visible = True
End Sub
Private Sub optTab_Click(Index As Integer)
TabStrip1.SelectedItem = TabStrip1.Tabs(Index + 1)
End Sub
Private Sub TabStrip1_Click()
ChoiceFrame(SelectedTab - 1).Visible = False
SelectedTab = TabStrip1.SelectedItem.Index
ChoiceFrame(SelectedTab - 1).Visible = True
optTab(SelectedTab - 1).Value = True
End Sub
|
|
|
|
|
|