Array Design idea:
In VB, the number of elder sister is 60, so we deal with the problem by error capture, where we use the UBound function
Public Function Arrayrange (Marray as Variant) as Integer
Dim I as Integer
Dim Ret as Integer
Dim ERRF as Boolean
ERRF = False
On Error GoTo Errhandle
' To determine whether an incoming argument is an array
If not IsArray (Marray) Then
Arrayrange =-1
Exit Function
End If
' VB in the largest array of 60
For i = 1 to 60
' Using the UBound function to determine the upper bound of a dimension, if the actual dimension of the large array produces out of range error,
' Now we're catching the wrong error by resume Next.
Ret = UBound (Marray, i)
If ERRF Then Exit for
Next I
' Last return
Arrayrange = Ret
Exit Function
Errhandle:
Ret = i-1
ERRF = True
Resume Next
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.