ErrorContext Property
Topic Last Modified: 2006-11-30
A string that identifies the context of the error. Usually the control or method in which the error occurred. The ErrorContext property applies to the ControlEventArgs Class.
Syntax
Property ErrorContext As String
string ErrorContext
Remarks
This property is read-only.
Example
The following Visual Basic .NET example shows a ControlError Event handler function that displays the error context.
Private Sub OnControlError(ByVal o As Object, ByVal e As EventArgs) _
Handles treeView.ControlError
' Declare the ControlEventArgs object.
Dim evtArgs As ControlEventArgs
' Cast e to a ControlEventArgs object.
evtArgs = CType(e, ControlEventArgs)
Debug.WriteLine("Context: " + evtArgs.ErrorContext)
End Sub
The following C# example shows a ControlError Event handler function that displays the error context.
void OnControlError(object o, EventArgs e )
{
// Cast e to a ControlEventArgs object.
ControlEventArgs evtArgs = (ControlEventArgs)e;
Debug.WriteLine("Context: " + evtArgs.ErrorContext);
}