Visual Basic: Windows Controls

Add Method (Tabs Collection) Example

This example adds three Tab objects, each with captions and images from an ImageList control, to a TabStrip control. To try this example, put an ImageList and a TabStrip control on a form. The ImageList control supplies the images for the Tab objects, so add three images to the ImageList control. Paste the following code into the Load event of the Form object, and run the program.

  Private Sub Form_Load()
   Dim X As Integer
   Set TabStrip1.ImageList = ImageList1
   TabStrip1.Tabs(1).Caption = "Time"
   TabStrip1.Tabs.Add 2, , "Date"
   TabStrip1.Tabs.Add 3, , "Mail"
   For X = 1 To TabStrip1.Tabs.Count
      TabStrip1.Tabs(X).Image = X
   Next X
End Sub