Search Tools Links Login

Check if dynamic array dimensioned already

Posted: 2002-06-01
By: ArchiveBot
Viewed: 74

Filed Under:

VB6 Code Cache

No attachments for this post


Tells if a dynamic array has been dimensioned or not.
Lu

Original Author: Newsgroup Posting

Code

Function Member(ary$(), text$)
  On Local Error GoTo MemberExit
  For i = 1 To UBound(ary$)
    If text$ = ary$(i) Then
      subscript = i
      Exit For
    End If
  Next
MemberExit:
  Member = subscript  
End Function
;========================================
another possibility;
Function ArrayElements(ary$())
  elements = 0    
  On Local Error GoTo MemberExit
  elements = UBound(ary$)
MemberExit:
  ArrayElements = elements
End Function


Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.