Hi.
Is there a property that tells you if your Dynamic Array has no elememts in it?
If I use UBound, I get an error for an empty array. There should be a way to do this rather than depending on the Err object.
Thanks for your help.
Printable View
Hi.
Is there a property that tells you if your Dynamic Array has no elememts in it?
If I use UBound, I get an error for an empty array. There should be a way to do this rather than depending on the Err object.
Thanks for your help.
I use this to parsr a userdefined array
I search for User.nick
Code:Public Function ParseArray() As Boolean
Dim Loops As Integer
Dim Username As String
On Error GoTo ArrayErr ' Error handling enabled
For Loops = 0 To UBound(usr) '- 1
If InStr(usr(Loops).Nick, Username) Then ParseArray = True
Next Loops
Exit Function
ArrayErr:
If Err.Number = 9 Then
'Call MsgBox("Empty array", vbInformation)
ParseArray = False
Else
'oops
End If
On Error GoTo 0 ' Error handling disabled
End Function
It seems like you are using the Err object to detect an empty array. I know how to do that. I was wondering if there was a property or something that would let you know that a Dynamic Array was empty? Or is the Err.Number = 9 the only way?
Thx.
I am pretty sure you are using something like this. But here it goes anyway.
Code:Private Sub Form_Click()
Dim d(4) As String
Dim i As Integer
For i = LBound(d) To UBound(d)
If d(i) = "" Then Me.Print d(i) & " Empty"
Next
End Sub
No there isn't, eitherway errorhandling or have a items counter. Also you could go for having option base 1 and use the 1 element array as empty array.
Shark.
I think you mis-understood what I was trying to do. :( Kedaman!! At last, someone understands what I'm talking about! :)
Thanks again.
Well, you know, this topic has been up so many times lately :)
I didn't know...or I wouldn't have asked. :)
I don't know how but what about
Code:IsEmpty(expression)
No, that's for variants that hasn't got a content yet