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

out of the range

Thread ID:

Created:

Updated:

Platform:

Replies:

26385 Mar 22,2005 02:08 PM UTC Mar 23,2005 04:11 PM UTC WinForms 4
loading
Tags: GridControl
Nietzsche
Asked On March 22, 2005 02:08 PM UTC

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.

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

Nietzsche
Replied On 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.

Nietzsche
Replied On March 23, 2005 03:05 PM UTC


Administrator [Syncfusion]
Replied On 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();
}

CONFIRMATION

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.

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

;