Help Center

AppendElementToArrayfunction

Appends a new element to the array.

String ManagementfunctionAfxArrays.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Parameters

NameDescription
rgThe array.
elemThe element to append.

Description

Appends a new element to a dynamic one-dimensional array.

Remarks

The array and the element to append can be of any type, but they have to be of the same type between them.

If the array has a fixed length, GetLastError will return an E_ACCESSDENIED error.

Examples

#macro AppendElementToArray(rg, elem)

#define XSTRING DWSTRING ' // or STRING, BSTRING, etc. DIM rg(ANY) AS XSTRING DIM xStr AS XSTRING = "String - " FOR i AS LONG = 1 TO 10 AppendElementToArray(rg, xStr & WSTR(i)) NEXT ' Display the array FOR i AS LONG = LBOUND(rg) TO UBOUND(rg) print rg(i) NEXT

Reference

  • Include file AfxArrays.inc
  • Documented in String Management/Array Macros.md
  • Topic: Array Macros