다음을 통해 공유


ErrorMethod Property

Topic Last Modified: 2006-11-30

The method in which the error occurred. The ErrorMethod property applies to the ControlGeneratedEventArgs Class.

Syntax

Property ErrorMethod As String
string ErrorMethod

Remarks

This property is read-only.

Example

The following Visual Basic .NET example shows a ControlGeneratedError Event handler function that displays the method in which the error occurred.

Private Sub OnControlGeneratedError(ByVal o As Object, ByVal e As EventArgs) _
    Handles treeView.ControlGeneratedError

     ' Declare the ControlGeneratedEventArgs object.
     Dim evtArgs As ControlGeneratedEventArgs

     ' Cast e to a ControlGeneratedEventArgs object.
     evtArgs = CType(e, ControlGeneratedEventArgs)

     Debug.WriteLine("Error occurred in: " + evtArgs.ErrorMethod)

End Sub

The following C# example shows a ControlGeneratedError Event handler function that displays the method in which the error occurred.

void OnControlGeneratedError(object o, EventArgs e )
{
     // Cast e to a ControlGeneratedEventArgs object.
     ControlGeneratedEventArgs evtArgs = (ControlGeneratedEventArgs)e;

     Debug.WriteLine("Error occurred in: " + evtArgs.ErrorMethod);

}