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

out of the range

Hi, when I run this code (when a oCol is a collection not empty): private GridGroupingControl grdResult; ... private void grdResult_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) { // grdResult.TableControl.CurrentCell.Activate( e.Inner.RowIndex, 1, 0 ); // oCol.RemoveAt(e.Inner.RowIndex-2); // grdResult.DataSource = null; grdResult.DataSource = col; grdResult.TableControl.CurrentCell.MoveTo(oCol.Count+1,0,0); grdResult.TableControl.ScrollCellInView( grdResult.TableControl.CurrentCell.RowIndex, grdResult.TableControl.CurrentCell.ColIndex ); // } the following exception is raised on ".MoveTo(...)" : Specified argument was out of the range of valid values. Parameter name: Index was out of range. Must be non-negative and less than the size of the collection. at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) at System.Windows.Forms.CurrencyManager.EndCurrentEdit() at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32 newPosition, Boolean validating, Boolean endCurrentEdit, Boolean firePositionChange, Boolean pullData) at System.Windows.Forms.CurrencyManager.set_Position(Int32 value) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableBase.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) at Syncfusion.Grouping.Table.NotifyEnterRecordComplete(Boolean success) at Syncfusion.Grouping.CurrentRecordManager.EnterRecord(Element record) at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record, Boolean cancelEditIfNotValid, Boolean scrollInView) at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.ControlEnterRecord(Element record) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.OnCurrentCellActivating(GridCurrentCellActivatingEventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellActivating(Int32& rowIndex, Int32& colIndex, GridSetCurrentCellOptions& options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at ... I am using: - Syncfusion Suite 2.1.0.30 - DotNet Framework 1.1 - Windows XP Pro SP2 Waiting for one answer. Thanks of everything.

4 Replies

AD Administrator Syncfusion Team March 22, 2005 03:10 PM UTC

Hi Nietzsche, Based on the call stack it looks like there is a current record that was marked modified. Does it help if you set Table.CurrentElement = null; - or - Table.CurrentRecordManager.Navigate(null); - or - Table.CurrentRecordManager.Reset(); before you set the datasource to null. Stefan >Hi, >when I run this code >(when a oCol is a collection not empty): > >private GridGroupingControl grdResult; >... > >private void grdResult_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) >{ >// >grdResult.TableControl.CurrentCell.Activate( e.Inner.RowIndex, 1, 0 ); >// >oCol.RemoveAt(e.Inner.RowIndex-2); >// >grdResult.DataSource = null; >grdResult.DataSource = col; >grdResult.TableControl.CurrentCell.MoveTo(oCol.Count+1,0,0); >grdResult.TableControl.ScrollCellInView( grdResult.TableControl.CurrentCell.RowIndex, grdResult.TableControl.CurrentCell.ColIndex ); >// >} > > >the following exception is raised on ".MoveTo(...)" : > >Specified argument was out of the range of valid values. >Parameter name: Index was out of range. Must be non-negative and less than the size of the collection. > >at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) >at System.Windows.Forms.CurrencyManager.EndCurrentEdit() >at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32 newPosition, Boolean validating, Boolean endCurrentEdit, Boolean firePositionChange, Boolean pullData) >at System.Windows.Forms.CurrencyManager.set_Position(Int32 value) >at Syncfusion.Windows.Forms.Grid.Grouping.GridTableBase.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) >at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.OnCurrentRecordContextChange(CurrentRecordContextChangeEventArgs e) >at Syncfusion.Grouping.Table.NotifyEnterRecordComplete(Boolean success) >at Syncfusion.Grouping.CurrentRecordManager.EnterRecord(Element record) >at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record, Boolean cancelEditIfNotValid, Boolean scrollInView) >at Syncfusion.Grouping.CurrentRecordManager.NavigateTo(Element record) >at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.ControlEnterRecord(Element record) >at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.OnCurrentCellActivating(GridCurrentCellActivatingEventArgs e) >at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellActivating(Int32& rowIndex, Int32& colIndex, GridSetCurrentCellOptions& options) >at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) >at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) >at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) >at ... > > >I am using: >- Syncfusion Suite 2.1.0.30 >- DotNet Framework 1.1 >- Windows XP Pro SP2 > > >Waiting for one answer. > >Thanks of everything.


NI Nietzsche March 23, 2005 03:04 PM UTC

I tried the solutions you proposed, but they doesn''t work. I send a sample. If You delete the last record the exception raised. Waiting for one answer. Thanks of everything.


NI Nietzsche March 23, 2005 03:05 PM UTC



AD Administrator Syncfusion Team March 23, 2005 04:11 PM UTC

This code seems to delete the row fro me in your sample.
private void grdResult_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e)
{
	e.TableControl.Table.GetCurrencyManager().Position -= 1;
	oCol.RemoveAt(e.Inner.RowIndex-2);
	grdResult.Engine.Table.TableDirty = true;
	grdResult.Refresh();
}

Loader.
Live Chat Icon For mobile
Up arrow icon