Tag Property (ActiveX Controls)

       

Returns or sets an expression that stores any extra data needed for your program. Unlike other properties, the value of the Tag property isn't used by Visual Basic; you can use this property to identify objects.

Syntax

object.Tag [= expression]

The Tag property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
expression A string expression identifying the object. The default is a zero-length string ("").

Remarks

You can use this property to assign an identification string to an object without affecting any of its other property settings or causing side effects. The Tag property is useful when you need to check the identity of a control or MDIForm object that is passed as a variable to a procedure.

Tip   When you create a new instance of a form, assign a unique value to the Tag property.

Note   The Tag property is of type Variant for ActiveX control collections such as Toolbar Button objects, TreeView Node objects, ListView ListItem and ColumnHeader objects, ImageList ListImage objects, TabStrip Tab objects, and StatusBar Panel objects. You can use the Tag property to pass values, but it does not allow you to pass objects.