Results 1 to 10 of 10

Thread: In Dis--Array

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question

    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.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    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 !!!!!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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.

  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    247

    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
    Mako Shark
    Great White

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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.

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Ignorance is Bliss!

    I didn't know...or I wouldn't have asked.

  9. #9
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    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 !!!!!

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
  •  



Click Here to Expand Forum to Full Width