3

I need to update an old classic asp, and I have to call a function that normally returns an array, but under certain circumstances might return either Nothing or an undefined value.

How can I check that the result actually returns an array?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794

6 Answers6

5

er... I could be wrong, but isn't it just something like

If something Is Nothing Then
   'Do something here
Else
   'Do what I used to
End If
Powerlord
  • 87,612
  • 17
  • 125
  • 175
4

Is the function late bound / has a Variant return value? If so, the IsArray function will check whether it contains an array type.

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
2

If TypeName(something) = "Empty" Then ...

Anonymous
  • 21
  • 1
2

IsNull() should work I think.

John M Gant
  • 18,970
  • 18
  • 64
  • 82
0

Ugly, but functional!

Function IsNothingType( ByRef obj )
    If TypeName(obj) = "Nothing" Then
        IsNothingType = True
    Else
        IsNothingType = False
    End If  
End Function
BuvinJ
  • 10,221
  • 5
  • 83
  • 96
-1

If you are using VBScript/WSH then you may want to try the "typeof" function/method. It worked for me while the above did not.