Msg#: 4223961 posted 4:49 pm on Oct 29, 2010 (gmt 0)
Hi, I'm currently working with an Classic ASP page (VB Script) that utilizes the same array at several points during the page. After each use, I erase the array. The problem is, what is the best way to detect if the array is empty through an if/then statement?
Here's how I've been erasing the arrays: If IsArray(a) Then Erase a End If
In the outer If/Then statement, I test for IsArray(array) The array that had been erased still exists.
On the inner If/Then statment, I'd been using Not IsEmpty(array) as well as UBound(array)<>-1 although I would get an error message when using the latter (out of range), while in the former, an erased array would show as "true" (not empty). In the meantime, I've created flags as a workaround, but it's not the ideal situation. Any help or resources would be greatly appreciated.
Msg#: 4223961 posted 8:31 pm on Oct 29, 2010 (gmt 0)
Thanks, From what I've read, it seems that the Erase method clears the array. Would the ReDim method be preferrable in this case?
Also, in determining if the array is greater than 0, I can't use UBound. Do the following look correct? I'm not familiar with "Is Nothing". When I added it, I got the "object required" message. If Not(IsNull(vArray(a))) And Not(IsEmpty(vArray(a))) And Not(a) Is Nothing)