README.md

December 4, 2022 ยท View on GitHub

Check if dynamic array dimensioned already

Description

Tells if a dynamic array has been dimensioned or not.

Lu learly@ix.netcom.com

More Info

Submitted On
ByNewsgroup Posting
LevelUnknown
User Rating4.2 (159 globes from 38 users)
CompatibilityVB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryData Structures
WorldVisual Basic
Archive File

Source 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