Export (0) Print
Expand All

Visual Basic: Windows Controls

Visual Studio 6.0

Tab Object

See Also    Example    Properties    Methods    Events

A Tab object represents an individual tab in the Tabs collection of a TabStrip control.

Remarks

For each Tab object, you can use various properties to specify its appearance, and you can specify its state with the Selected property.

At design time, use the Insert Tab and Remove Tab buttons on the Tabs tab in the Properties Page of the TabStrip control to insert and remove tabs, and use the text boxes to specify any of these properties for a Tab object: Caption, Image, ToolTipText, Tag, Index, and/or Key. You can also specify these properties at run time.

Use the Caption and Image properties, separately or together, to label or put an icon on a tab.

  • To use the Caption property, in the Caption text box on the Tabs tab in the Properties Page of the TabStrip control, type the text you want to appear on the tab or button at run time.

  • To use the Image property, put an ImageList control on the form and fill the ListImages collection with ListImage objects, each of which has an index number and an optional key, if you add one. On the General tab in the Properties Page of the TabStrip control, select that ImageList to associate it with the TabStrip control. In the Image text box on the Tabs tab, type the index number or key of the ListImage object that should appear on the Tab object.

Use the ToolTipText property to temporarily display a string of text in a small rectangular box at run time when the user's cursor hovers over the tab. To set the ToolTipText property at design time, select the ShowTips checkbox on the General tab, and then in the ToolTipText text box on the Tabs tab, type the ToolTip string.

To return a reference to a Tab object a user has selected, use the SelectedItem property; to determine whether a specific tab is selected, use the Selected property. These properties are useful in conjunction with the BeforeClick event to verify or record data associated with the currently-selected tab before displaying the next tab the user selects.

Each Tab object also has read-only properties you can use to reference a single Tab object in the Tabs collection: Left, Top, Height and Width.

Show:
© 2014 Microsoft