Skip to content

SetArrayElementByIndex

Include: Use System\Reflection.pkg

See Also: ArrayTypeOf, ArrayDimensionCount, ArrayDimentionSize, ValueTypeOfArray, ArrayInstanceSize, ArrayElementByIndex

Purpose

Writes an array element by zero-based index.

Syntax

Procedure SetArrayElementByIndex Global Variant ByRef vArray Integer iIndex Variant vValue

Arguments

vArray : Array value passed by reference.

iIndex : Zero-based element index.

vValue : New value to assign to the selected element.

Returns

This procedure does not return a value.

Behavior

vArray must be passed by reference. vValue is converted using normal DataFlex assignment rules where possible. Wrong type, missing byref, and unreachable indexes raise a DataFlex error.

Example

String[] asNames
Integer iSize
Variant vName

Move "Ada" to asNames[0]
Get ArrayInstanceSize asNames to iSize
Get ArrayElementByIndex asNames 0 to vName
Send SetArrayElementByIndex (&asNames) 0 "Grace"