The following example demonstrates using the Client-coordinate properties û ClientLeft, ClientTop, ClientWidth, and ClientHeight û along with a Frame control array to display tab û specific objects in the internal area of the TabStrip control when switching tabs. The example uses the ZOrder method to display the appropriate Frame control and the objects it contains.
To try this example, place a TabStrip control and a three-element Frame control array on the form. In one Frame control, place a CheckBox control, in another, place a CommandButton control, and in the third, place a TextBox control. Paste the following code into the Load event of the Form object, and run the program. Click the various tabs to select them and their contents.
Private Sub Form_Load()
Dim Tabx As Object
Dim i As Integer
' Sets the caption of the first tab to "Check."
TabStrip1.Tabs(1).Caption = "Check"
' Adds a second tab with "Command" as its caption.
Set Tabx = TabStrip1.Tabs.Add(2, , "Command")
' Adds a third tab with "Text" as its caption.
Set Tabx = TabStrip1.Tabs.Add(3, , "Text")
' Aligns the frame containers with the internal
' area of the TabStrip control.
For i = 0 To 2
With TabStrip1
Frame1(i).Move .ClientLeft, .ClientTop, _
.ClientWidth, .ClientHeight
End With
Next
' Puts the first tab's picture box container on top
' at startup.
Frame1(0).ZOrder 0
End Sub
Private Sub TabStrip1_Click()
Frame1(TabStrip1.SelectedItem.Index - 1).ZOrder 0
End Sub