Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you check for empty or null array 2

Status
Not open for further replies.

faust13

Programmer
Joined
Aug 7, 2001
Messages
176
Location
US
How do you check if an array is empty? --------------------------------------
Is George Lucas Kidding...
Noise Core: 7.62
 
if the array has never been allocated then it is NOTHING. If it is allocated but empty then the upperbound is -1. To eliminate NOTHING, allocate with upperbound of -1.
Dim ary1Str() as string ' Nothing
Dim ary2Str(-1) as string ' array with No elements

I use (-1) unless I have a size in mind to avoid problems.

Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Having to do it. I find it simpler to Dim ary1str(-1). It will pass right through
For I = 0 to Ubound(ary1Str)
....
Next
if ary1Str Is Nothing then Ubound(ary1Str) throws an error. Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top