CodeItBetter Programming Another VB Programming Blog

How to find out the number of dimensions of the given array

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
'Arrays, Collections, Lists - How to find out the number of dimensions of the given array
'This routine returns the number of dimensions of the array passed as 
'an argument, or 0 if it isn't an array.
Function NumberOfDims(arr As Variant) As Integer
    Dim dummy As Long
    On Error Resume Next
    Do
        dummy = UBound(arr, NumberOfDims + 1)
        If Err Then Exit Do
        NumberOfDims = NumberOfDims + 1
    Loop
End Function

Related posts:

  1. How to sum all the elements in an two dimensional array
  2. How to check whether an item exists in a collection
  3. How to sum all the elements in an array
  4. How to evaluate the total number of elements in a two dimensional array
  5. How to delete an item in an array
  6. How to store all the selected items in a ListBox in an array
  7. How to insert an item in an array
  8. How to Scramble the order of elements in an array.
  9. How to resize an array without losing its contents
  10. How to get Dimensions of an image

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.