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

Grid Control CurrentCell not reset when RowCount = 0

Thread ID:





94682 May 26,2010 09:07 PM UTC Jun 2,2010 04:42 AM UTC WinForms 3
Tags: GridControl
Julie Levy
Asked On May 26, 2010 09:07 PM UTC

Hi -
I have a situation where the only row of a GridControl is removed using Rows.RemoveRange and the CurrentCell object is still representing a cell in that row (which was the current cell when the row was removed). This is causing problems in our code in keypress events (where the rowindex and columnindex are still set to that cell) as well as the CurrentCellChanged event which is firing (see my attached screenshot). The Renderer is null so i can check for that in the event, but i'm wondering if there's something that can be done to null out the CurrentCell so that the events don't fire.

I don't know if this is a bug or due to something i'm doing in code. It's present in both versions 5.2 (VS2005) and 7.4 (VS2008).


Christopher Issac Sunder K [Syncfusion]
Replied On May 28, 2010 02:38 PM UTC

Hi Julie,

Thank you for your interest in Syncfusion products.

While removing the rows using RemoveRange() method, the current cell renderer cannot get refreshed and notifies the old indexes. Hence, we can make use of MoveTo() method after removing the range to force the current cell to refresh.

Here is the code snippet regarding this,

this.gridControl1.Rows.RemoveRange(0, this.gridControl1.RowCount);
if (this.gridControl1.RowCount == 0)
this.gridControl1.CurrentCell.MoveTo(0, 0, GridSetCurrentCellOptions.SetFocus); //refresh the current cell


Please refer the following sample which illustrates the above.


Please let me know if you have any further concerns.

Christopher K.

Julie Levy
Replied On June 1, 2010 09:42 PM UTC

Thanks. That worked.

Christopher Issac Sunder K [Syncfusion]
Replied On June 2, 2010 04:42 AM UTC

Hi Julie,

Thank you for the update.

We are glad to hear this.

Thank you for using Syncfusion products.

Christopher K.


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