Skip to Content
0
Former Member
Nov 30, 2011 at 10:22 AM

NullReferenceExeption on Mouse Move Event

27 Views

Hi alltogether!

I've got the same problem as in this thread, that is closed without solution (as i can see):

Frustrating Error - Please Help

I don't know if somebody got it solved (haven't search for this more), but i did it! 😊

Here it is:

Origin code that couses error:

Imports CrystalDecisions.CrystalReports.Engine

Public Class ReportForm

  Private _rpt As myCRReport

  Sub New(ByVal rep As myCRReport)
      ' This call is required by the designer.
      InitializeComponent()

      ' Add any initialization after the InitializeComponent() call.
      _rpt = rep
  End Sub

  Private Sub ReportForm_Activated(sender As Object, e As System.EventArgs) Handles Me.Activated
    Try
      'Set ReportSource of CRViewer
      Me.myCRViewer.ReportSource = _rpt
    Catch ex As Exception
    End Try
  End Sub
End Class

To solve the problem i set the Enabled property of myCRViewer to false.

So:

Private Sub ReportForm_Activated(sender As Object, e As System.EventArgs) Handles Me.Activated
    Try
      Me.myCRViewer.Enabled = False
      'Set ReportSource of CRViewer
      Me.myCRViewer.ReportSource = _rpt
    Catch ex As Exception
      Debug.Assert(ex.Message)
    Finally
      Me.myCRViewer.Enabled = True
    End Try
End Sub

best regards,

Johann

Edited by: JoAx75 on Nov 30, 2011 12:54 PM