CryptoSys PKI Pro Manual

Find length of byte array

Traditional method: To find the length of an existing byte array:

nLen = UBound(abData) - LBound(abData) + 1

Be careful, as this will cause a run-time error if abData() has not been ReDim'd.

Safer method: Use the VBA wrapper function cnvBytesLen.

Dim ab() As Byte
Debug.Print cnvBytesLen(ab) ' Expecting 0
ReDim ab(10)    ' NB actually 11 elements (0..10)
Debug.Print cnvBytesLen(ab) ' 11
[PREV: Pre-dimensioning for VB6...]   [Contents]   [Index]   
   [NEXT: Zero-length byte arrays in VB6/VBA...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.