-
Hi! There!
OK, My problem is with an TypeUserDefined Array.
How can i know if my array is empty???
for example
i have
MODULE:
Type anyType
a1 as string *2
a2 as string *2
a3 as string *2
a4 as string *2
a5 as string *2
End Type
global arr() as anyType
FORM:
if i do a reference to my Array without set a number of elements it's obviously that it generates an error,ok, my question is if, there is an instruction or a function to validate if ANY array is empty.
I tried this
Call-->
bFlag= bEmpty(arr())
Function-->
Function bEmpty(rgArr() as anyType) as boolean
On Error Resume Next
If LBound(rgArr())<0 then
bEmpty=True
else
bEmptyFalse
End If
End Function
but, as you can see, if i had 10, 15, 'x' number of arrays i would need to do one function by array.....
-
There isn't, artificially you could check for subscript out of range error:
Code:
On error resume next
X=Arrayname(0)
if err=9 then msgbox "empty array"
on error goto 0
-
Elements in Array
Why don“t you use intElements = Ubound(anyArray)
That will return the number of elements stored in the array.