DSAFEARRAY.Appendmethod
Appends a value to the end of the one-dimensional safe array.
Syntax
FUNCTION Append (BYVAL pData AS ANY PTR) AS HRESULT
FUNCTION Append (BYREF bsData AS BSTRING) AS HRESULT
FUNCTION Append (BYREF dvData AS DVAEIANT) AS HRESULT
FUNCTION Append (BYVAL vData AS VARIANT) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
pData | Pointer to a variable of the appropriate data type. | |
bsData | The BSTRING to insert, if the safe array is of type VT_BSTR. | |
dvData | The DVARIANT to insert, if the safe array is of type VT_VARIANT. | |
vData | The VARIANT to insert, if the safe array is of type VT_VARIANT. |
Return value
S_OK (0) on success or an HREUSLT code on failure.
Description
Appends a value to the end of the one-dimensional safe array.
Appends a string to the end of the one-dimensional safe array.
Examples
' // Creates a one-dimensional array of doubles 'DIM dsa AS DSAFEARRAY = DSAFEARRAY(VT_R8, 2, 1) DIM dsa AS DSAFEARRAY = DSAFEARRAY("DOUBLE", 2, 1)
DIM dblVal AS DOUBLE = 12345.12 dsa.Put(1, @dblVal) dblVal = 74447.34 dsa.Put(2, @dblVal) dblVal = 63535.567 dsa.Append(@dblVal)
dsa.Get(1, @dblVal) print dblVal dsa.Get(2, @dblVal) print dblVal dsa.Get(3, @dblVal) print dblVal
' // Creates a one-dimensional array of variants 'DIM dsa AS DSAFEARRAY = DSAFEARRAY(VT_VARIANT, 2, 1) DIM dsa AS DSAFEARRAY = DSAFEARRAY("VARIANT", 2, 1) dsa.PutVar(1, "Test string") dsa.PutVar(2, 12345) dsa.AppendVar("Test string appended")
DIM dvOut AS DVARIANT dvOut = dsa.GetVar(1) print dvOut dvOut = dsa.GetVar(2) print dvOut dvOut = dsa.GetVar(3) print dvOut
Reference
- Include file
DSafeArray.inc - Defined in AfxNova/DSafeArray.inc:1610
- Documented in COM/DSAFEARRAY Class.md
- Topic: DSAFEARRAY Class