DSAFEARRAY.Redimmethod
Changes the right-most (least significant) bound of a safe array.
Syntax
FUNCTION Redim (BYVAL pnewsabounds AS SAFEARRAYBOUND PTR) AS HRESULT
FUNCTION Redim (BYVAL cElements AS ULONG, BYVAL lLBound AS LONG) AS HRESULT
FUNCTION Redim (BYVAL cElements1 AS ULONG, BYVAL lLBound1 AS LONG, BYVAL cElements2 AS ULONG, BYVAL lLBound2 AS LONG) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
pnewsabounds | Pointer to a new safe array bound structure that contains the new array boundary. You can change only the least significant dimension of an array. | |
cElements | Number of elements in the array. | |
lLBound | The lower bound of the array. | |
cElements1 | Number of elements in the first dimension of the array | |
lLBound1 | The lower bound of the first dimension of the array. | |
cElements2 | Number of elements in the second dimension of the array | |
lLBound2 | The lower bound of the second dimension of the array. |
Return value
S_OK (0) on success or an HRESULT code on failure.
Description
Changes the right-most (least significant) bound of a safe array.
Multidimensional array:
One-dimensional array:
Two-dimensional array:
Example
' // One-dimensional array of VT_VARIANT ' // Two elements, lower-bound 1 'DIM dsa AS DSAFEARRAY = DSAFEARRAY(VT_VARIANT, 2, 1) DIM dsa AS DSAFEARRAY = DSAFEARRAY("VARIANT", 2, 1) DIM dv1 AS DVARIANT = "Test variant 1" dsa.PutVar(1, dv1) DIM dvOut AS DVARIANT dvOut = dsa.GetVar(1) print dvOut
DIM dv2 AS DVARIANT = "Test variant 2" dsa.PutVar(1, dv2) dvOut = dsa.GetVar(1) print dvOut
' // Redim (preserve) the safe array dsa.Redim(1, 3) DIM dv3 AS DVARIANT = "Test variant 3" dsa.PutVar(3, dv3) dvOut = dsa.GetVar(3) print dvOut
Reference
- Include file
DSafeArray.inc - Defined in AfxNova/DSafeArray.inc:814
- Documented in COM/DSAFEARRAY Class.md
- Topic: DSAFEARRAY Class