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

How to set CurrentCell to -1, -1

Thread ID:





45583 Jun 23,2006 07:26 PM UTC Jun 26,2006 01:30 PM UTC WinForms 3
Tags: GridControl
Maxim Software Systems
Asked On June 23, 2006 07:26 PM UTC

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.

Administrator [Syncfusion]
Replied On 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

Maxim Software Systems
Replied On 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?

Maxim Software Systems
Replied On 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.


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