Siebel VB Language Reference > VB Language Reference >

IsEmpty Function

This standard VB function is used to determine whether a variable of data type variant has been initialized.





Any expression containing a variable of data type variant


-1 (TRUE) if a variant has been initialized; 0 (FALSE) otherwise.


IsEmpty returns -1 (TRUE) if the variant is of vartype 0 (empty). Any newly defined variant defaults to being of Empty type, to signify that it contains no initialized data. An Empty variant converts to zero when used in a numeric expression, or a null string ("") in a string expression.


This example prompts for a series of test scores and uses IsEmpty to determine whether the maximum allowable limit has been hit. (IsEmpty determines when to exit the Do...Loop.)

Sub Button_Click
   Dim arrayvar(10)
   Dim x as Integer
   Dim tscore as Single
   Dim total as Integer
   x = 1
      tscore = 88
      arrayvar(x) = tscore
      x = x + 1
   Loop Until IsEmpty(arrayvar(10)) <> -1
   total = x-1
   msgtext = "You entered: " & Chr(10)
   For x = 1 to total
       msgtext = msgtext & Chr(10) & arrayvar(x)
      Next x
End Sub

See Also

IsDate Function
IsNull Function
IsNumeric Function
VarType Function

Siebel VB Language Reference