-
Oct 14th, 2000, 02:44 PM
#1
Thread Starter
Fanatic Member
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.
-
Oct 14th, 2000, 03:04 PM
#2
Hyperactive Member
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
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Oct 14th, 2000, 03:19 PM
#3
Thread Starter
Fanatic Member
Private, thanks for the Public Answer :) but
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.
-
Oct 14th, 2000, 03:35 PM
#4
Addicted Member
Hi OneSource.
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
-
Oct 14th, 2000, 03:36 PM
#5
transcendental analytic
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.
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 14th, 2000, 03:49 PM
#6
Thread Starter
Fanatic Member
Thanks guys.
Shark.
I think you mis-understood what I was trying to do. Kedaman!! At last, someone understands what I'm talking about!
Thanks again.
-
Oct 14th, 2000, 03:59 PM
#7
transcendental analytic
Well, you know, this topic has been up so many times lately
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 14th, 2000, 05:16 PM
#8
Thread Starter
Fanatic Member
Ignorance is Bliss!
I didn't know...or I wouldn't have asked.
-
Oct 14th, 2000, 06:31 PM
#9
Hyperactive Member
I don't know how but what about
Code:
IsEmpty(expression)
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Oct 14th, 2000, 06:54 PM
#10
transcendental analytic
No, that's for variants that hasn't got a content yet
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|