This documentation is archived and is not being maintained.

IsError Function

Returns a Boolean value indicating whether an expression is an exception type.

Public Function IsError(ByVal Expression As Object) As Boolean


Required. Object expression.


IsError returns True if the expression represents an Object variable that derives from the Exception class in the System namespace.

An exception that derives from System.Exception can be caught with the Try...Catch...Finally statements.


This example uses the IsError function to check if an expression represents a system exception.

Dim ReturnVal As Object
Dim BadArg As String   ' Name of out-of-range argument.
Dim MyCheck As Boolean
' ...
ReturnVal = New System.ArgumentOutOfRangeException(BadArg)
' ...
MyCheck = IsError(ReturnVal)   ' Returns True.


Namespace: Microsoft.VisualBasic

Module: Information

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

IsArray Function | IsDate Function | IsDBNull Function | IsNothing Function | IsNumeric Function | IsReference Function | Object Data Type | TypeName Function