CorArray: CreateInstance

CreateInstance

Initializes a new array of the specified type in up to 3 dimensions.



 Public Function CreateInstance(
	  ByVal ElementType As VbVarType,
	  Optional ByVal Length1 As Long = 0,
	  Optional ByRef Length2 As Variant,
	  Optional ByRef Length3 As Variant ) As Variant

Parameters

ElementType
[ByVal] VbVarType. The data type the array represents.
Length1
[ByVal] Optional. Long. The number of elements in the first dimension.  

Default: 0

Length2
[ByRef] Optional. Variant. The number of elements in the second dimension.
Length3
[ByRef] Optional. Variant. The number of elements in the third dimension.

Return Values

Variant -  An array of the specified type with the specified dimensions.

Remarks

If a length is zero, then an empty array is returned, not a Null array. If one length is defined as zero, then all other defined lengths must be zero. This does not mean that lengths 2 and 3 need to be set to zero if only an empty one-dimensional array is being created.

Exceptions

Exception Condition
ArgumentExceptionElementType is not a valid type.
ArgumentOutOfRangeException Length1 is less than zero.
-or-
Length2 is less than zero.
-or-
Length3 is less than zero.

See Also

Project CorLib Overview

Class CorArray Overview