Share via


CatalogManager.AddPropertyValue

Ee799660.c++_on(en-US,CS.10).gifEe799660.vb_off(en-US,CS.10).gif

Use this method to add a value to the list of defined values for the specified enumeration.

Definition

Sub AddPropertyValue(strPropertyName As String,strLegalValue As String)

Parameters

strPropertyName

A String that contains the name of the enumeration property for which a new value will be defined.

strLegalValue

A String that contains the new value.

Return Values

None.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_PROP_DOESNT_EXIST &H88980005 The property you specified did not exist.
E_CAT_PROP_NOT_ENUM &H88980007 The property you specified was not of type cscEnumeration.
E_CAT_VALUE_ALREADY_ADDED &H88980008 The enumeration value you specified was already present in the list.
OLE_E_BLANK &H80040007 The object was not initialized. The Initialize method must be called before calling any other method.

Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

The AddPropertyValue method is used only for properties whose data type is cscEnumeration.

This method adds a new value to the list of defined values for an enumeration property. Any attempts by a client to set this property to a value other than one of the legal values will result in an error. This method is useful for automatic validation against properties that only have a small, fixed set of values. For example, a Color property may have red, green, and blue as the only defined values.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

myCatalogManager.AddPropertyValue "color", "Blue"

See Also

CatalogManager Object

CatalogManager.GetPropertyValues

CatalogManager.RemovePropertyValue


All rights reserved.