VLPropertyList Reference

ReadOnly PropertyKey

See Also See Also Applies To Applies To

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

 

Syntax

object.Key

 

The Key property syntax has these parts:

PartDescription
object An object expression that evaluates to CProperty.
string A unique string identifying a member in a collection.

 

Remarks

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.