Share via


ContentListSchema.Add

Ee824300.c++_on(en-US,CS.10).gifEe824300.vb_off(en-US,CS.10).gif

Use this method to add a new column to a schema for use by a ContentListFactory object and its associated ContentList objects.

Definition

Function Add(sName As String,Type As ColumnTypeEnum,Flags As Long) As Long

Parameters

sName

A String that contains a name for the new column.

Type

A value from the ColumnTypeEnum enumeration. See the Remarks section for more details.

Flags

A Long that contains the bit mask column flag settings for the new column.

Return Values

If this method completes successfully, it returns a Long that contains the position of the new column. Column positions are numbered starting with zero (0), not one (1).

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

Once the Locked property has been set to True, subsequent calls to this method will fail. The ContentListFactory object will set the Locked property of its ContentListSchema object to True when one of the following conditions is met:

  • Rows of data are allocated in the factory by setting the Count property or calling the ConstructFromRecordset method.

  • The ContentListFactory object has been used to construct one or more ContentList objects using the CreateNewContentList method.

The following table shows the values of the ColumnTypeEnum enumeration, their associated names, and describes their use.

Name Value Description
CLCOL_I2 2 A 16-bit integer. This value corresponds to the VARTYPE value VT_I2.
CLCOL_I4 3 A 32-bit integer. This value corresponds to the VARTYPE value VT_I4.
CLCOL_R4 4 A single precision floating point number. This value corresponds to the VARTYPE value VT_R4.
CLCOL_R8 5 A double precision floating point number. This value corresponds to the VARTYPE value VT_R8.
CLCOL_CY 6 A 64-bit integer used to store a currency value. This value corresponds to the VARTYPE value VT_CY. Monetary values stored using this type are scaled by 10,000 (4 decimal places). For example, the value 86900 would correspond to a currency value of $8.69 in the US. This is also the same as the money datatype used by SQL7.
CLCOL_DATE 7 A double precision floating point number used to store a date/time value. This value corresponds to the VARTYPE value VT_DATE.
CLCOL_DISPATCH 9 A reference to an object that supports scripting/automation (inherits from IDispatch). This value corresponds to the VARTYPE value VT_DISPATCH.
CLCOL_BOOL 11 A boolean value. This value corresponds to the VARTYPE value VT_BOOL. Do not confuse this with the C++ type BOOL, which is 4 bytes.
CLCOL_UNKNOWN 13 A pointer to an IUnknown-based interface that, presumably, does not support scripting/automation (inherits from IUnknown). This value corresponds to the VARTYPE value VT_UNKNOWN.
CLCOL_STRING 14 A pointer to a string in the private heap maintained by every ContentListFactory object. There is no corresponding VARTYPE value.
CLCOL_VARIANTARRAY 15 A pointer to a SAFEARRAY. The corresponding variant type is VT_ARRAY or VT_VARIANT.

Ee824300.note(en-US,CS.10).gif Note

  • With the exception of CLCOL_STRING and CLCOL_VARIANTARRAY, these types are identical to the corresponding VARTYPE and share the same constant value. They may be used as a VARTYPE.

Example

'"Color" is the column name.
'CLCOL_STRING indicates the column is of type String.
'0 indicates that no flags are applied.

dim iColumnNum as Long
iColumnNum = myContentListSchema.Add("Color", CLCOL_STRING, 0)

See Also

ContentListSchema Object


All rights reserved.