I am using Crystal reports for Visual Studio 2005
I have a form with a grid and an crystal report viewer when I update an item in the grid the report needs to be refresh to show the updated value. This mostly works, however if when I change focus from the updated item directly to the grid I get the following error:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="CrystalDecisions.Windows.Forms"
StackTrace:
at CrystalDecisions.Windows.Forms.PageControl.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at CrystalDecisions.Windows.Forms.PageControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
...
The code that updates the report when a cell is edited is:
ReportDocument doc = new ReportDocument();
doc.Load(loadString);
doc.SetDataSource(reportSourceDataSet);
crystalReportViewer1.ReportSource = doc;
If I comment out the last line then I don't get the exception but then the report doesn't update so that doesn't really help me.
Anyone know what is happening here?