We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

NullReferenceException again

I have two different forms with the same GDBG class on them. If I change a value in a column that has a custom CellRenderer and there''s only ONE window open, everything works fine. If I do this same change when both windows are open, I get the dump below. It doesn''t happen when I leave this column - it occurs when I leave the row. What can I look for or do? catched at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.EndEdit() in :line 0 An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.grid.dll Additional information: Object reference not set to an instance of an object. catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Deactivate(Boolean discardChanges) in :line 0 Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Deactivate(Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.InternalMove(GridDirectionType direction, Int32 num, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridSelectCellsMouseController.GridCurrentCellExternalMove(GridDirectionType direction, Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Move(GridDirectionType direction, Int32 num, Boolean extendSelection, Boolean wrapCell) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Move(GridDirectionType direction, Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridControlBase.OnKeyDown(KeyEventArgs e) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnKeyDown(KeyEventArgs e) at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m) at Syncfusion.Windows.Forms.Grid.GridControlBase.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.Control.ProcessKeyMessage(Message& m) at Syncfusion.Windows.Forms.Grid.GridControlBase.ProcessKeyMessage(Message& m) at System.Windows.Forms.Control.WmKeyChar(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.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.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at TimelineManager.TimelineInterface.Main() in c:\moss adams\holman - timeline\development\timelinemanager\timelineinterface.cs:line 1579The program ''[3056] TimelineManager.exe'' has exited with code 0 (0x0).

6 Replies

LO Lori January 6, 2005 01:02 AM UTC

More details : I''m using version 2.1.0.9. I am calling NotifyCurrentCellChanged.


LO Lori January 6, 2005 06:28 AM UTC

More information : Have further information - forget the information about the two windows. The value being changed by the custom renderer is also the current sort column of the grid. If changing the value causes the row order to change, that''s when I''m getting the NullReferenceException.


AD Administrator Syncfusion Team January 6, 2005 07:19 AM UTC

Getting a sample showing the problem that we can debug would be helpful. If you temporarily replace your custom cell type with our default "TextBox" celltype, does the problem go away? This would either eliminate the custom control as the source of teh problem, indicate that it plays a role in the problem.


LO Lori January 6, 2005 04:00 PM UTC

My grid/project is now sufficiently complex that putting together a sample isn''t doable. But some help with events & event order might help me discover something. I''ve added dummy CurrentCellDeactivating & CurrentCellDeactivated event handlers and put WriteLines in. When the exception occurs, I get a CurrentCellDeactivating without a CurrentCellDeactivated (makes sense from the stack dump). Is there something that I can look at in the CurrentCellDeactivating event that would tell me that the grid is going to do an EndEdit call in CurrentCellDeactivated? Or, is there another event I can hook that gets invoked between CurrentCellDeactivating & CurrentCellDeactivated? Thanks!


AD Administrator Syncfusion Team January 6, 2005 04:28 PM UTC

You can test CurrentCell.IsModified to see if the currentcell thinks it has been modified. You can also test currentcell.IsEditing. After CurrentCellDeactivating is raised, you will get a CurrentCellValidating (if there is a change) and possibly a CurrentCellCloseDropDown and maybe a CurrentCellCOntrolLostFocus before teh deactivated event is raised. If you have the source code, you can check out: Syncfusion\Essential Suite\3.0.1.0\Windows\Grid.Windows\Src\Base\Control\GridCurrentCell.cs(1462) if (!Grid.RaiseCurrentCellDeactivating())


LO Lori January 6, 2005 05:02 PM UTC

Actually the EndEdit that''s failing isn''t at the CurrentCell level. It''s the Binder.EndEdit that''s being invoked from CurrentCellDeactivated due to the need to flush the row. The custom cell in question isn''t even the current cell when this error occurs.

Loader.
Live Chat Icon For mobile
Up arrow icon