Lotusscript function ArrayGetIndex gives error when checking the result

Hi

I am using the lotusscript function ArrayGetIndex.

This method can return a long or Null. I am trying to use the result in a if then else statement to find out what the result is of this method.

i use the following:

Dim yu as variant

yu = ArrayGetIndex(doc.ProdCodes,prod,0))

if Not yu is Nothing then

… some code…

else

… some code…

end if

when ever yu is not Null the code returns an error when getting to the if ststement.

How can I safely check the result of this method without getting into the errorhandler?

Regards

Subject: Lotusscript function ArrayGetIndex gives error when checking the result

Use

Not isNull(yu)

Yu will be NULL if prod is not in doc.ProdCodes

Subject: Lotusscript function ArrayGetIndex gives error when checking the result

You check for Null with Isnull:

If Isnull(variantVariableHere) Then

Nothing is not the same thing as Null. Nothing is an object variable without a reference. Null is a special value that a Variant can contain. (And Empty is another.)