ControlError Event
Topic Last Modified: 2006-06-13
The ControlError Event is used for returning low-priority error information, for example, when an attempt is made to create folders or roots with duplicate names in the TreeView control.
Applies To
Event Data
The event handler receives a ControlEventArgs object as an argument containing data related to this event. The following properties provide information specific to this event.
Property | Description |
---|---|
The error constant. For more information, see LocalizableErrors Enumeration. |
|
A string that identifies the context of the error. Usually the control or method in which the error occurred. |
|
The error message. |
Examples
Visual Basic .NET
The following is an example of a ControlError event handler in Microsoft® Visual Basic® .NET.
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("Error text: " + evtArgs.ErrorText)
Debug.WriteLine("Error constant: " + evtArgs.ErrorConstant)
Debug.WriteLine("Context: " + evtArgs.ErrorContext)
End Sub
C#
The following is an example of a ControlError event handler in Microsoft C#.
void OnControlError(object o, EventArgs e )
{
// Cast e to a ControlEventArgs object.
ControlEventArgs evtArgs = (ControlEventArgs)e;
Debug.WriteLine("Error text: " + evtArgs.ErrorText);
Debug.WriteLine("Error constant: " + evtArgs.ErrorConstant);
Debug.WriteLine("Context: " + evtArgs.ErrorContext);
}