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

CurrentCell.MoveTo not working

I am using a GridControl which I load from memory. When I first create and manage the grid I try to set the default selection to a row in the grid and move the current cell to that row. I am doing something like: gridControl1.Selections.Clear(); gridControl1.CurrentCell.MoveTo(irow, 0); gridControl1.Selections.Add(Syncfusion.Windows.Forms.Grid.GridRangeInfo.Row(irow)); gridControl1.ScrollCellInView(irow, 0); (this is something of an oversimplification, but that's the gist). Anyway, the MoveTo does not seem to be doing anything and the next time I go to use the CurrentCell.RowIndex or CurrentCell.ColumnIndex they still have values of -1. The return result of the MoveTo call is false; the ErrorMessage property of the CurrentCell is empty. I tried adding a try/catch block and I tried adding a MoveFailed event handler but neither caught anything. I suspect that I am simply doing something wrong but I am having trouble figuring out what. Could you perhaps give me some hints on when MoveTo will not work? Are there settings for the grid control with which it is not compatible? Will it only work after a certain point in the initialization of the grid (similar to controls that need things done on load instead of in the constructor)? Any ideas you can throw my way would be greatly appreciated. Thanks, Cathy

1 Reply

AD Administrator Syncfusion Team May 27, 2003 07:51 PM UTC

Set ForceCurrentCellMoveTo = true when positioning the current cell before the grid is initially displayed. Otherwise the grid tries to delay setting the current cell until it is shown. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon