Share via


CharPosition Property (RuntimeErrorEventArgs)

The character position within the line that the runtime error occurred on.

XAML
Cannot be used in XAML.
Scripting
value = eventargs.CharPosition

Property Value

integer

The character position the runtime error occurred on.

This property is read/write, but should be considered read-only because there is no reason to change the reported information. There is no default.

Remarks

This property is technically read/write, but there is generally no reason to set it, because the property is just reporting information from existing errors.

Examples

The following JavaScript example shows the portion of an event handler that displays error information specific to runtime errors.

JavaScript
    // errorArgs is an instance of RuntimeErrorEventArgs
    if(errorArgs.ErrorType == "RuntimeError")
    {
      var runtimeErrorMsg = "Silverlight Runtime Error  \n\n";
            
      // Basic error event informaiton.
      runtimeErrorMsg += "Error Type:    " + errorArgs.errorType     + "\n";
      runtimeErrorMsg += "Error Message: " + errorArgs.errorMessage  + "\n";
      runtimeErrorMsg += "Error Code:    " + errorArgs.errorCode  + "\n";
            
      // Runtime specific error event information.
      if (errorArgs.lineNumber != 0)
      {
        runtimeErrorMsg += "Line:     " + errorArgs.lineNumber     + "\n";
        runtimeErrorMsg += "Position: " +  errorArgs.charPosition  + "\n";
      }
     
     runtimeErrorMsg += "MethodName: " + errorArgs.methodName     + "\n";
            
     alert(runtimeErrorMsg);
    }

Applies To

RunTimeErrorEventArgs

See Also

Silverlight Application Scripting Error Handling
ErrorEventArgs
ParserErrorEventArgs