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

Exception in QueryNextEnabledCell

Thread ID:





5812 Jul 18,2003 06:04 AM UTC Jul 18,2003 10:21 AM UTC WinForms 2
Tags: GridControl
Jan Hornych
Asked On July 18, 2003 06:04 AM UTC

Hi, I get an exception NullReferenceException in QueryNextEnabledCell method when I use keyboard keys Left or Up to move the current cell left or up and there are only cells with Enabled==false left or above of it. My grid is virtual, I use event handlers for QueryColCount, QueryRowCount, QueryCellInfo, SaveCellInfo and QueryCoveredRange. As I have no source code, I cannot find the reason and workaround for that. I believe I have to set some other property on my disabled cells to avoid crash in QueryNextEnabledCell. Could you give me an idea, what can cause that exception in QueryNextEnabledCell ? I've attached the stack info as file. At that moment the current cell was on column 6, I pressed left. Columns 1 to 5 have Enabled=false. Thanks for hints. Regards, Jan

Administrator [Syncfusion]
Replied On July 18, 2003 08:23 AM UTC

Here is the code.
case GridDirectionType.Left:
	while (targetCol >= 1 && !enabled)
		// skip invisible and covered cells
		while (targetCol >= 1
			&& (grid.GetColWidth(targetCol) == 0
			|| gridModel.CoveredRanges.Find(targetRow, targetCol, out coveredRange)
			&& coveredRange.Left != targetCol

		if (targetCol >= 1)
			gridModel.CoveredRanges.Find(targetRow, targetCol, out coveredRange);
			style = grid.GetViewStyleInfo(coveredRange.Top, coveredRange.Left);
			enabled = style.Enabled || grid.IsDesignMode();

			// not enabled, continue search
			if (!enabled && targetCol >= 1)
So, it does rely on covered cells heavily. If you can attach a sample project, or submit a Direct Trac support incident with a sample, we can see if we can spot something here.

Jan Hornych
Replied On July 18, 2003 10:21 AM UTC

Thanks, it helped. My mistake was setting e.Range=null;e.Handled=true; in QueryCoveredRange event handler in case no covering was applicable for the cell. After change only to e.Handled=false; in this case, everything works fine. Thank you once more. Jan


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