TbsTab class

One tab of a TabStrip: its caption, picture, key, state and place. A program gets one from the TbsTabs collection, from that collection’s Add method, from SelectedItem and from HitTest, and the events TabBeforeClick and TabClick pass one. It cannot make a TbsTab object with New.

Dim Tab As TbsTab
Set Tab = TabStrip1.Tabs.Add(, "find", "&Find")
Tab.ToolTipText = "Search the text"
Tab.Selected = True
Debug.Print Tab.Caption; Tab.Index; Tab.Selected
' Output:
' &Find 2 True

Properties

Caption

The text of the tab. String. Default: empty. It is the default member.

A letter that follows an ampersand (&) is the tab’s access key: Alt and that letter select the tab, with the events of Selected.

Height

The height of the tab, in the scale units of the control’s container. Single, read-only.

An assignment to Height, Left, Top or Width raises run-time error 383.

HighLighted

Whether the tab is drawn highlighted, to draw the user’s attention to it without selecting it. Boolean. Default: False. It shows nothing in a control drawn with visual styles.

Image

The picture of the tab: its number or its key in the strip’s ImageList. A Variant. A tab without a picture gives 0, and 0 takes the picture away.

The property returns what was assigned, a number or a key, and ImageIndex is the number either way. A key that the list does not have raises run-time error 35601, Element not found.

ImageIndex

The number of the tab’s picture in the strip’s list, from 1, or 0 for none. Long, read-only.

Index

The number of the tab in the strip, from 1. Long, read-only. It changes when a tab is added or removed before this one.

Key

The key of the tab in the TbsTabs collection. String. Empty for a tab without a key.

An assignment gives the tab another key, and the collection no longer finds it by the old one. An empty string takes the key away. A key that another tab has raises run-time error 457.

Left

The distance from the left edge of the control to the tab, in the scale units of the control’s container. Single, read-only.

Pressed

Whether the tab is drawn pressed. Boolean. It has a meaning where the strip’s Style is a style of buttons, where tabs can stay pressed, several of them with MultiSelect.

Selected

Whether the tab is the selected one. Boolean. True selects the tab, with the events described in Changing the selected tab. False on the selected tab leaves no tab selected, and on another tab does nothing.

Tag

A value of the program’s own, which the strip does not use. Variant: unlike the Tag of a control it holds a value of any type, an object included, which is assigned with Set.

ToolTipText

The text shown in a small window when the pointer rests on the tab. String. Default: empty. It shows only while the strip’s ShowTips is True.

Top

The distance from the top edge of the control to the tab, in the scale units of the control’s container. Single, read-only.

Width

The width of the tab, in the scale units of the control’s container. Single, read-only.

See Also