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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

NullReferenceException

Thread ID:

Created:

Updated:

Platform:

Replies:

17094 Jul 30,2004 08:48 PM UTC Jul 30,2004 09:28 PM UTC WinForms 1
loading
Tags: GridControl
Lori S. Pearsall
Asked On July 30, 2004 08:48 PM UTC

I have a Combobox column in a GDBG. In the CurrentCellValidating event, there''s a particular case where I want to cancel the change. So I execute the following code : grid.CurrentCell.CancelEdit(); e.Cancel = true; Visually, the column changes back to the previous value. However, when I then tab out of the column, I get the following error : ------- catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Validate() 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.ConfirmChanges(Boolean closeDropDown) in :line 0 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.GridCurrentCell.MoveRight(Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveRight() 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 1392The program ''[3308] TimelineManager.exe'' has exited with code 0 (0x0). ------- I''ve examined the CellValue after the e.Cancel = true statement, and it''s not null. Since this error isn''t occurring in my code, what do I need to start looking for? I''m not sure what it thinks is null.

Administrator [Syncfusion]
Replied On July 30, 2004 09:28 PM UTC

Instead of calling grid.CurrentCell.CancelEdit();, try this code to see if it avoids this problem. GridCurrentCell cc = grid.CurrentCell; cc.Renderer.Control.Text = grid[cc.RowIndex, cc.ColIndex].Text; e.Cancel = true;

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;