Share via


ErrorMessage Property

Topic Last Modified: 2006-11-30

The high-priority error message. The ErrorMessage 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 error message.

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 message: " + evtArgs.ErrorMessage)

End Sub

The following C# example shows a ControlGeneratedError Event handler function that displays the error message.

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

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

}