MESCIUS.ActiveReports.Viewer.Wpf Assembly / GrapeCity.ActiveReports.Viewer.Wpf Namespace / Viewer Class / ErrorOccured Event
Example

ErrorOccured Event (Viewer)
Occurs when an error occurs within the viewer. This event provides detailed information about the error, allowing for custom error handling or logging.
Syntax
'Declaration
 
Public Event ErrorOccured As EventHandler(Of ErrorInfo)
 
Event Data

The event handler receives an argument of type ErrorInfo containing data related to this event. The following ErrorInfo properties provide information specific to this event.

PropertyDescription
Gets a value indicating the detailed error information.  
Gets a value indicating the exception associated with the error, if any.  
Gets a value indicating the general error information.  
Gets a value indicating the severity level of the error.  
Remarks
The GrapeCity.Viewer.Common.Model.ErrorInfo object passed as a parameter to the event handler contains details about the error, including the exception object, a user-friendly message, and potentially other metadata related to the error condition.
Example
viewer.ErrorOccured += (sender, e) =>
{
    // Log error details
    Console.WriteLine($"Error: {e.Exception.Message}");
    // Show a user-friendly message
    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
};
See Also