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

Exception in QueryNextEnabledCell

Thread ID:

Created:

Updated:

Platform:

Replies:

5812 Jul 18,2003 02:04 AM Jul 18,2003 06:21 AM Windows Forms 2
loading
Tags: GridControl
Jan Hornych
Asked On July 18, 2003 02:04 AM

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 04:23 AM

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
			)
			)
			targetCol--;

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

			// not enabled, continue search
			if (!enabled && targetCol >= 1)
				targetCol--;
		}
	}
break;
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 06:21 AM

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

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.

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.

;