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.
Unfortunately, activation email could not send to your email. Please try again.

RemoveRange

Thread ID:

Created:

Updated:

Platform:

Replies:

30829 Jun 24,2005 09:42 AM Jul 1,2005 09:37 AM Windows Forms 10
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 24, 2005 09:42 AM

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 09:53 AM

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 10:03 AM

Actually i use an inherited GridControl Control

Administrator [Syncfusion]
Replied On June 24, 2005 10:27 AM

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 11:54 AM

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 06:13 AM

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 07:29 AM

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 08:16 AM

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 08:32 AM

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 08:32 AM

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 09:37 AM

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.

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.

;