Key Property (ActiveX Controls)
Collapse the table of content
Expand the table of content

Key Property (ActiveX Controls)

Visual Studio .NET 2003

Returns or sets a string that uniquely identifies a member in a collection.


object.Key [= string]

The Key property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
string A unique string identifying a member in a collection.


If the string is not unique, an error will occur.

You can set the Key property when you use the Add method to add an object to a collection.

The value of the Index property of an object can change when objects in the collection are reordered, such as when you set the Sorted property to True. If you expect the Index property to change dynamically, refer to objects in a collection using the Key property.

In addition, you can use the Key property to make your Visual Basic project "self-documenting" by assigning meaningful names to the objects in a collection.

See Also

Applies To: LightSources Collection

© 2015 Microsoft