Share via


Visual Basic: DataGrid Control

Error Event (DataGrid Control)

See Also   Example   Applies To

Occurs only as the result of a data access error that takes place when no Visual Basic code is being executed.

Syntax

Private Subobject_Error([ indexAs Integer,] ByValdataerrorAs Integer, responseAs Integer)

The Error event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
Index An integer that identifies a control if it is in a control array.
dataerror An integer that identifies the error that occurred.
response An integer that may be set to 0 to suppress error message display, as described in Settings.

Settings

The settings for response are:

Setting Description
0 No error message will be displayed.
1 (Default) The message associated with the error will be displayed.

Remarks

Even if your application handles run time errors in code, errors can still occur when none of your code is executing, as when the user clicks a Data control button or changes the current record by interacting with a bound control. If a data access error results from such an action, the Error event is fired.

Not adding code to this event is equivalent to setting the response argument to 0.

Note   Use the ErrorText property to retrieve the error string that will be displayed.