- Joined
- Oct 5, 2001
- Messages
- 30,080
Sirp,
It really depends on what sort of array you are working with....
If you are working with a string array, it is do-able in a clever - but fast - manner. If you're not, then it is doable, but a bit slower.
Basically, for any array, just loop through from the lower bound to the upper bound and test each value.
Eg:
For stringarrays, you can use the join function to check it a bit faster...
These functions will both return "true" for an empty array, false otherwise.
I haven't tried it on control or object arrays though....
It really depends on what sort of array you are working with....
If you are working with a string array, it is do-able in a clever - but fast - manner. If you're not, then it is doable, but a bit slower.
Basically, for any array, just loop through from the lower bound to the upper bound and test each value.
Eg:
Code:
Private Function CheckArray(vArray() As Variant) As Boolean
Dim vTest As Variant
For Each vTest In vArray
If (vTest <> 0) Then
CheckArray = False
Exit Function
End If
Next vTest
CheckArray = True
End Function
For stringarrays, you can use the join function to check it a bit faster...
Code:
Private Function CheckStringArray(sArray() As String) As Boolean
Dim sTotal As String
sTotal = Join(sArray, "")
If Len(sTotal) = 0 Then
CheckStringArray = True
Else
CheckStringArray = False
End If
End Function
These functions will both return "true" for an empty array, false otherwise.
