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
close icon

How to set CurrentCell to -1, -1

Is it possible to return the state of the CurrentCell in a GridControl back to what it was before any cell was actually selected. I''ve tried moving the CurrentCell to -1, -1, but that doesn''t work.

3 Replies

AD Administrator Syncfusion Team June 23, 2006 08:11 PM UTC

Hi Don, Regarding the previous selected cell movement: Try this code to retrun back to the previously selected cell in a grid. Here is a code snippet. int prevRowIndex = -1; int prevColIndex = -1; private void gridControl1_CurrentCellMoving(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellMovingEventArgs e) { prevColIndex = this.gridControl1.CurrentCell.ColIndex; prevRowIndex = this.gridControl1.CurrentCell.RowIndex; } private void button2_Click(object sender, System.EventArgs e) { this.gridControl1.CurrentCell.MoveTo(prevRowIndex,prevColIndex); } Regarding the cell(-1,-1): You need to call the CurrentCell. MoveTo method to move the current cell to required position(-1,-1). this.gridControl1.CurrentCell.MoveTo(-1,-1); Here is a sample. http://www.syncfusion.com/Support/user/uploads/GridControlCurrentCell_f52c60e7.zip Let me know if this helps. Best Regards, Haneef


MS Maxim Software Systems June 23, 2006 08:42 PM UTC

> Regarding the previous selected cell movement I meant the "-1,-1" cell that was selected before the user actually selects a cell in grid, but thanks for the info. >Regarding the cell(-1,-1): > >You need to call the CurrentCell. MoveTo method >to move the current cell to required >position(-1,-1). > >this.gridControl1.CurrentCell.MoveTo(-1,-1); Yes, this is what I tried to do and it didn''t work. I tried putting this exact code in a test button on my form and it had no effect. Putting a watch on the CurrentCell I saw that the rowindex and colindex properties didn''t change. Am I missing something?


MS Maxim Software Systems June 26, 2006 01:30 PM UTC

The closest I seem to be able to get to doing what I want is calling: mygrid.CurrentCell.SetPositionNoActivate(-1, -1) Unfortunately, it still looks like the previously selected cell is still active when I do this.

Loader.
Live Chat Icon For mobile
Up arrow icon