Add Method (Tabs Collection)

           

Adds a Tab object to a Tabs collection in a TabStrip control.

Syntax

object.Add(index, key, caption, image)

The Add method syntax has these parts:

Part Description
object An object expression that evaluates to a Tabs collection.
index Optional. An integer specifying the position where you want to insert the Tab. If you don't specify an index, the Tab is added to the end of the Tabs collection.
key Optional. A unique string that identifies the Tab. Use key to retrieve a specific Tab. This is equivalent to setting the Key property of the new Tab object after the object has been added to the Tabs collection.
caption Optional. The string that appears on the Tab. This is equivalent to setting the Caption property of the new Tab object after the object has been added to the Tabs collection.
image Optional. The index of an image in an associated ImageList control. This image is displayed on the tab. This is equivalent to setting the Image property of the new Tab object after the object has been added to the Tabs collection.

Remarks

To add tabs to the TabStrip control at design time, click the Insert Tab button on the Tab tab in the Properties Page of the TabStrip control, and then fill in the appropriate fields for the new tab.

To add tabs to the TabStrip control at run time, use the Add method, which returns a reference to the newly inserted Tab object. For example, the following code adds a tab with the caption, "Howdy!" whose key is "MyTab," as the second tab (its index is 2):

Set X = TabStrip1.Tabs.Add(2,"MyTab","Howdy!")