KAL_0801
05-18-2004, 09:21 PM
How can you test if a dynamic array has not been dimensioned yet?
Checking an Array.KAL_0801 05-18-2004, 09:21 PM How can you test if a dynamic array has not been dimensioned yet? LaVolpe 05-18-2004, 09:26 PM There is a somewhat complicated way using APIs. But the often used way is error trapping: ' pass your array to this homemade function Public Function IsDimensioned(vArray) As Boolean On Error Resume Next IsDimensioned=( LBound(vArray)<UBound(Varray)+1 ) If Err Then Err.Clear Exit Function OnErr0r 05-18-2004, 09:36 PM You can also use this method, which does not require an error trap: ' Usage: pass "Not arrayname" to the function ' If the array is not redimmed, the compliment of the array pointer is all ones ' If the array is redimmed, the value is the compliment of the pointer Public Function IsArrayEmpty(ByVal lArrayPointer As Long) As Boolean IsArrayEmpty = (lArrayPointer = -1) End Function |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum