Caption Property (Tab Object) Example

This example sets the Caption property for each of three Tab objects it adds to a TabStrip control. The caption strings are "Time," "Date," and "Mail." Each Tab object also displays an image from an ImageList control. To try this example, place an ImageList and a TabStrip control on a form. Place three sample bitmaps in the ImageList control. The ImageList control supplies the images for the Tab objects. Paste the following code into the Load event of the Form object, and run the program.

Private Sub Form_Load()
   Dim X As Integer
   ' Associate an ImageList with the TabStrip control.
   Set TabStrip1.ImageList = ImageList1
   ' Set the captions.
   TabStrip1.Tabs(1).Caption = "Time"
   TabStrip1.Tabs.Add 2, , "Date"
   TabStrip1.Tabs.Add 3, , "Mail"
   For X = 1 To TabStrip1.Tabs.Count
      ' Associate an image with a tab.
      TabStrip1.Tabs(X).Image = X
   Next X
End Sub