Help Center

DSAFEARRAY.Sortmethod

Sorts a one-dimensional VT_BSTR DSAFEARRAY calling the C qsort function.

COMmethodDSafeArray.incdocumented

Syntax

FUNCTION Sort (BYVAL bAscend AS BOOLEAN = TRUE) AS HRESULT

Parameters

NameDescription
bAscendTRUE for sorting in ascending order; FALSE for sorting in descending order.

Return value

S_OK (0) on success or an HRESULT code on failure.

Description

Sorts a one-dimensional VT_BSTR DSAFEARRAY calling the C qsort function.

Example

' // Create a one-dimensional array of BSTR DIM bsVal AS BSTRING = "bcde" dsa.PutStr(1, bsVal) bsVal = "abc" dsa.PutStr(2, bsVal) bsVal = "abcfg" dsa.PutStr(3, bsVal) ' // Sort the safe array dsa.Sort

bsVal = dsa.GetStr(1) print bsVal bsVal = dsa.GetStr(2) print bsVal bsVal = dsa.GetStr(3) print bsVal

Reference

  • Include file DSafeArray.inc
  • Defined in AfxNova/DSafeArray.inc:2153
  • Documented in COM/DSAFEARRAY Class.md
  • Topic: DSAFEARRAY Class