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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception in virtual grid

Thread ID:





38878 Dec 20,2005 04:51 PM UTC Dec 31,2005 07:50 PM UTC WinForms 4
Tags: GridControl
Ken Law
Asked On December 20, 2005 04:51 PM UTC

I have a virtual grid where I''m using QueryCellInfo for displaying data and SaveCellInfo for updating certain cells. I''m getting the following unhandled exception often. I''m still trying to find a sequence of steps that causes it, but it generally seems to happen when clicking on a cell (it must at that point be in some state). Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.GridControlBase.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Is this a known problem? I''m using Thanks

stanleyj [Syncfusion]
Replied On December 20, 2005 05:00 PM UTC

Hi Ken, In your QueryCellInfo and SaveCellInfo handler have you checked for e.RowIndex > 0, if not please try. void GridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 0) { // // // } } Regards, Stanley

Ken Law
Replied On December 20, 2005 08:45 PM UTC

Actually, I''m using QueryCellInfo to set column header text like this: if (e.RowIndex == 0) e.Style.Text = this.GetColumnHeaderValue(e.ColIndex); I''ve done this with other grids with no problems. Here is the code from my SaveCellInfo event: try { //Move the changes back to the external data object. Checking for >1 so PartID cannot be affected if( e.RowIndex > 0 && e.ColIndex > 1 && e.RowIndex <= this.m_oECPartCycle.ECKnownPartList.Count) //col index >2 because SensorID and Freq columns should be read-only { // Note: calling with 1-based row and column index values this.SetCellValue(e.RowIndex, e.ColIndex, e.Style.CellValue.ToString()); } } catch{} e.Handled = true; Note that I do check for e.RowIndex > 0 here.

stanleyj [Syncfusion]
Replied On December 21, 2005 06:43 AM UTC

Hi Ken, I suggested those checks because QueryCellInfo handler queries from (-1,-1). The reason to query with -1 is to denote -1 for colstyles and rowstyles. If you could provide more detail on that then we may try suggesting something. You can also upload the sample so that the issue can be seen here. Thanks, Stanley

Ken Law
Replied On December 31, 2005 07:50 PM UTC

I seem to have eliminated the problem by setting some other properties. For example, I''ve made the cells that will not receive user input static and set some other properties.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon