I am attempting to get undo/redo to work with a virtual grid. Is this possible? I keep seeing a duo of caught exceptions in the debug output when I attempt to Undo an action:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: rowIndex
at Syncfusion.Collections.SFTable.set_Item(Int32 rowIndex, Int32 colIndex, Object value)
at Syncfusion.Windows.Forms.Grid.GridRowCollection.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfoStore value)
at Syncfusion.Windows.Forms.Grid.GridData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfoStore value)
at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly)
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: rowIndex
at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly)
at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType)
at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo[] cellsInfo, StyleModifyType modifyType)
at Syncfusion.Windows.Forms.Grid.GridChangeCellsCommand.Execute()
at Syncfusion.Windows.Forms.Grid.GridModelCommandManager.Execute(GridCommandMode mode)
catched at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) in :line 0
catched at Syncfusion.Windows.Forms.Grid.GridModelCommandManager.Execute(GridCommandMode mode) in :line 0
I am using the CommandStack at gridControl1.CommandStack. Is there a difference between using gridControl1.CommandStack and gridControl1.Model.CommandStack?
Jason
JT
Jason Thompson
September 10, 2003 03:17 PM UTC
I forgot to mention that the Undo I am attempting is the edit of a value in a cell. Undos for row resizing, column resizing, etc. seem to work fine.
Jason
AD
Administrator
Syncfusion Team
September 10, 2003 03:29 PM UTC
So, you are in the middle of typing into several cells, an dyou start pressing ctl+Z to undo things. Is this what you are doing?
This seems to work OK in the VirtGridTutorial sample if I add this.gridControl1.CommandStack.Enabled = true; to turn on the undo in that sample.
I suspect the problem is something to do with trying to place non numbers into numeric cells. Try setting DevStu to stop when you encounter an exception. This should stop you right at the problem, allowing you to look at the call stack to try to see what is going on.
JT
Jason Thompson
September 10, 2003 04:37 PM UTC
Actually, the problem occurred because the GridSaveCellInfoEventArgs e did not have a valid Style.CellIdentity member when the SaveCellInfo event was triggered by the Undo. Since I was assuming it to be valid, we all know what I made of myself :)
Thanks for the help!
Jason