Share via


ExceptionEventArgs Class

Provides Data for the HandleException event.

Namespace CrystalDecisions.Windows.Forms Assembly CrystalDecisions.Windows.Forms (CrystalDecisions.Windows.Forms.dll)

Syntax

'Declaration
Public Class ExceptionEventArgs
    Inherits ViewerEventArgs
public class ExceptionEventArgs : ViewerEventArgs

Remarks

The ExceptionEventArgs class contains the data related to the HandleException event. The HandleException event is raised by the CrystalReportViewer control when an exception occurs in the CrystalReportViewer control. The UserData property is a generic object, which can hold anything. It is used to override what is done in the handling of an exception. In almost all cases, if you assign a string to the UserData property, that message will be displayed to the user instead of the message contained in the exception.

Example

The following example gets the details of the HandleException event and creates a new entry in the event log.

'Declaration

          Private Sub LogHandleExceptionEvent(ByVal source As Object, _
          ByVal e As CrystalDecisions.Windows.Forms.ExceptionEventArgs) Handles _
          CrystalReportViewer.HandleException
          Dim eventLog As New EventLog("event.log")
          Dim eventMsg As String = _
          "HandleException event:" & vbCrLf & _
          "Exception: " & e.Exception().Message & vbCrLf & _
          "UserData: " & e.UserData()
          eventLog.WriteEntry(eventMsg)
          e.Handled = False
          End Sub
        
          private void LogHandleExceptionEvent(Object source,
          CrystalDecisions.Windows.Forms.ExceptionEventArgs e)
          {
          System.Diagnostics.EventLog eventLog =
          new System.Diagnostics.EventLog("event.log");
          string eventMsg =
          "HandleException event:" + "\n" +
          "Exception: " + e.Exception.Message + "\n" +
          "UserData: " + e.UserData.ToString();
          eventLog.WriteEntry(eventMsg);
          e.Handled = false;
          }
        

Inheritance Hierarchy

Object
   EventArgs
      ViewerEventArgs
         ExceptionEventArgs

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

ExceptionEventArgs Members
CrystalDecisions.Windows.Forms Namespace