ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Viewer.Win Assembly / GrapeCity.ActiveReports.Viewer.Win Namespace / Viewer Class / HandleError Method
The exception to report.
Example

In This Topic
    HandleError Method (Viewer)
    In This Topic
    Handles runtime errors by reporting them to the viewer's model for appropriate action.
    Syntax
    'Declaration
     
    Public Sub HandleError( _
       ByVal ex As Exception _
    ) 
    public void HandleError( 
       Exception ex
    )

    Parameters

    ex
    The exception to report.
    Remarks
    This method is intended to centralize error handling within the viewer control. It allows for a consistent approach to managing exceptions, such as logging errors or informing the user through the UI. The actual handling strategy is implemented within the viewer model.
    Example
    // Instantiating the Viewer control and adding it to a form.
    Viewer viewer = new Viewer();
    viewer.Dock = DockStyle.Fill;
    this.Controls.Add(viewer);
    // Example of handling an error that might occur during document loading.
    try
    {
        viewer.LoadDocument("path/to/your/report.rdlx");
    }
    catch (Exception ex)
    {
        viewer.HandleError(ex);
    }
    See Also