The following exception is thrown when I do the moveto(-1,-1):
System.ArgumentException: negative key
at Syncfusion.Windows.Forms.Grid.GridIndexDictionary.OnValidate(Object key, Object value)
at Syncfusion.Collections.TypedDictionaryBase.System.Collections.IDictionary.set_Item(Object key, Object value)
at Syncfusion.Windows.Forms.Grid.GridIndexDictionary.set_Item(Int32 key, Object value)
at Syncfusion.Windows.Forms.Grid.GridRowColSizeDictionary.set_Item(Int32 index, Int32 value)
at Syncfusion.Windows.Forms.Grid.GridModelRowColSizeIndexer.SetSize(Int32 index, Int32 value)
at Syncfusion.Windows.Forms.Grid.GridModelRowColSizeIndexer.SetRange(Int32 from, Int32 to, Int32[] values, Boolean discardUndo)
catched at Syncfusion.Windows.Forms.Grid.GridModelRowColSizeIndexer.SetRange(Int32 from, Int32 to, Int32[] values, Boolean discardUndo) in :line 0
which does cause the move to not occur. So how do I get the current row to be unset or point to -1,-1 like when the grid is intialized.
> I tried this code in a button handler and things seemed to work as expected.
>
> private void button1_Click(object sender, System.EventArgs e)
> {
> gridControl1.Focus();
> gridControl1.CurrentCell.MoveTo(-1, -1);
> gridControl1.ClearCells(GridRangeInfo.Table(), true);
> gridControl1.RowCount = 0;
>
> MessageBox.Show("EmptyGrid");
>
> gridControl1.Focus();
> gridControl1.RowCount = 20;
> }
>
>
> You might use the Debug|Exceptions menu item to set Common Language Runtime exceptions to break into teh debugger to see if there is some type of exception being thrown that would interfere with this behavior.
>
> Also, when you perform this code, what is teh state of the grid at that point? Is this code being call from an event handler that might not expect the RowCount to change?
>
> If you can reproduce the behavior in a sample project, you can submit in a Direct Trac support incident, and we will take a look at it to see if we can spot what is going on.