Perhaps a simple question, bu can anyone tell me the simplist way to count the depth of my array ... like the count method in the collection class.
Do I have to loop through until an error is raised to determine how many of an array I have?
Printable View
Perhaps a simple question, bu can anyone tell me the simplist way to count the depth of my array ... like the count method in the collection class.
Do I have to loop through until an error is raised to determine how many of an array I have?
If you have an array of a primitive data type (like Integer or Single) then use the UBound and LBound functions:
If it's a control array use the Count method or the UBound and LBound methods.Code:MsgBox "Number of items in the array: " & UBound(MyArray) - LBound(MyArray) + 1
Good luck!
Edited by Joacim Andersson on 02-24-2000 at 12:52 PM
Thank you, but it's actually an array of strings.
To be specific, it's an array created using Split() to separate folders froma path. ("C:\Windows\System\" becomes "C:", "Windows", and "System".
Nevermind ... UBound works.
Primitive Data Types are:
Byte
Integer
Long
Single
Double
Currency
String
Variant
Date
Boolean