Alex Rivera | Logout

How do I determine if an array is initialized in VB6?

Asked 2008-10-08T15:22:00.477
64

Passing an undimensioned array to the VB6's Ubound function will cause an error, so I want to check if it has been dimensioned yet before attempting to check its upper bound. How do I do this?

Edit
Report

1 Answer

0

My only problem with API calls is moving from 32-bit to 64-bit OS's.
This works with Objects, Strings, etc...

Public Function ArrayIsInitialized(ByRef arr As Variant) As Boolean
    On Error Resume Next
    ArrayIsInitialized = False
    If UBound(arr) >= 0 Then If Err.Number = 0 Then ArrayIsInitialized = True
End Function
answered 2012-08-12T04:14:44.907

Your Answer