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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

RemoveRange

Thread ID:

Created:

Updated:

Platform:

Replies:

30829 Jun 24,2005 01:42 PM UTC Jul 1,2005 01:37 PM UTC WinForms 10
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 24, 2005 01:42 PM UTC

Hello I noticed that the Rows.Removerange method behave differently in Syncfusion 2.0.5.1 and 3.2.1 Actually when i want to clear my grid i call this method Rows.Removerange (2,5) [i leave the 2 lines header] Again as it work on 2.0.5.1 it does not on 3.2.0.1: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: rowIndex at Syncfusion.Collections.SFTable.RemoveRows(Int32 rowIndex, Int32 count) at Syncfusion.Windows.Forms.Grid.GridData.RemoveRows(Int32 rowIndex, Int32 count) at Syncfusion.Windows.Forms.Grid.GridModelRowOperations.DataRemoveRange(Int32 removeAt, Int32 count) at Syncfusion.Windows.Forms.Grid.GridModelRowColOperations.RemoveRange(Int32 from, Int32 last) catched at Syncfusion.Windows.Forms.Grid.GridModelRowColOperations.RemoveRange(Int32 from, Int32 last) in :line 0 Thanks John

Administrator [Syncfusion]
Replied On June 24, 2005 01:53 PM UTC

Are you using a GridControl, or a GridDataBoundGrid? The code you showed will not work with a GridDataBoundGrid. For that grid, try using grid.Binder.RemoveRecords. In a GridControl, if you want to remove all rows except the first 2, you can set grid.RowCount = 2.

Administrator [Syncfusion]
Replied On June 24, 2005 02:03 PM UTC

Actually i use an inherited GridControl Control

Administrator [Syncfusion]
Replied On June 24, 2005 02:27 PM UTC

I tried RemoveRange in a GridControl 3.2.1.0. The only way I can see that exception is if grid.RowCount is set such that the arguments passed in to RemoveRange are not valid. So, you might check if your code is being hit twice. The first it works OK, but the second time it fails because the rows are already gone.

Administrator [Syncfusion]
Replied On June 24, 2005 03:54 PM UTC

Clay You are right, i call it twice! Since i use your first solution, i works fine ! (grid.RowCount = 2). Thanks Jonathan

Administrator [Syncfusion]
Replied On July 1, 2005 10:13 AM UTC

Actually, it does not work properly: When i do a Rows.Removerange(3,3) The row is grahically removed until a window is dragged over then...the line reappears...

Administrator [Syncfusion]
Replied On July 1, 2005 11:29 AM UTC

How do I see the problem in this sample? http://www.syncfusion.com/Support/user/uploads/GC_RemoveRange_75d9b297.zip Are there any exceptions being shown in your output window as you try this? Are you trying to do this while there is an open call to grid.BeginUpdate? If so, later when you call grid.EndUpdate, make sure you call grid.Refresh.

Administrator [Syncfusion]
Replied On July 1, 2005 12:16 PM UTC

You''re right i call it inside a beginupdate/Endupdate. But why should i call a refresh then ?

Administrator [Syncfusion]
Replied On July 1, 2005 12:32 PM UTC

Clay This problem occured only in 3.2.1 not in 2.0.5 Do you have any idea if something changed since ? Thanks Jonathan

Administrator [Syncfusion]
Replied On July 1, 2005 12:32 PM UTC

Clay This problem occured only in 3.2.1 not in 2.0.5 Do you have any idea if something changed since ? Thanks Jonathan

Administrator [Syncfusion]
Replied On July 1, 2005 01:37 PM UTC

There are many changes between 2.0 and 3.0. I am not sure what might have affected what you are doing. As a check, does commenting out the BeginUpdate and EndUpdate make things work for you? Instead of grid.Refresh, you might also get by just calling grid.ResetVolatileData. (This is one of several things that grid.Refresh does).

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

;