ThrowError Property  
 

Enables or disables error handling by the application.

Syntax

object.ThrowError [= { True | False } ]

Remarks

Error handling for methods can be performed using either return codes or exceptions, depending on the value of this property.

If the ThrowError property is set to False, methods will return a status value indicating success or failure. Applications should check the return value of each method and use the LastError and LastErrorString properties to determine the cause of any error.

If the ThrowError property is set to True, errors occurring within the control will be raised to the host application as ActiveX exceptions. In addition, the OnError event will fire. This allows applications to use language-specific exception handling mechanisms, such as Visual Basic error handling, instead of checking individual return values after each method call.

Even when the ThrowError property is set to True, the LastError and LastErrorString properties will still be updated with information about the most recent error.

If an error occurs while accessing a property value, an exception will be raised regardless of the value of the ThrowError property. However, the OnError event will not be fired for property access errors.

Data Type

Boolean

See Also

LastError Property, OnError Event