Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
WinGrid = System.IndexOutOfRangeException: Index was outside the bounds of the array
posted

Hi, I have a DataView binding to a grid. 

grid.DataSource = myDataView.

When I add new rows into this dataview, the grid does update correctly.

DataRowView drv = myDataView.AddNew()

drv.BeginEdit()

drv[myCol] = 0;

drv.EndEdit()

The problem is, when one of the grid column is sorted (by a single click on the grid column header), the grid crashes out when new data rows are added in.  The call stack is coming from the UltraGrid itself.  Can you help why the sorting causes this crash??  Why, without sorting the grid column first, does it work fine but crashes out after one column is sorted??

The call stack is as below:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Infragistics.Shared.SparseArray.ValidateIndex(Int32 index)
   at Infragistics.Shared.SparseArray.GetItem(Int32 index, ICreateItemCallback createItemCallback)
   at Infragistics.Shared.SparseArray.get_Item(Int32 index)
   at Infragistics.Win.UltraWinGrid.RowsCollection.RowsSparseArray.GetItem(Int32 index, Boolean create, Boolean calledFromScrollCountManagerSparseArray, Boolean& newRowCreated)
   at Infragistics.Win.UltraWinGrid.RowsCollection.RowsSparseArray.ToArray(Boolean create)
   at Infragistics.Win.UltraWinGrid.RowsCollection.InitNonGroupByRows(IList fireInitializeRowOnTheseRows)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRowsHelper(IList boundList)
   at Infragistics.Win.UltraWinGrid.RowsCollection.SyncRows()
   at Infragistics.Win.UltraWinGrid.RowsCollection.VerifyGroupByVersionHelper()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_ParentRow()
   at Infragistics.Win.UltraWinGrid.UltraGridRow.get_HiddenResolved()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.get_FirstRow()
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.GetMaxScrollPosition(Boolean scrollToFill)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.EnsureScrollRegionFilled(Boolean calledFromRegenerateVisibleRows)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.RegenerateVisibleRows(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.WillScrollbarBeShown(ScrollbarVisibility assumeColScrollbarsVisible)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.PositionScrollbar(Boolean resetScrollInfo)
   at Infragistics.Win.UltraWinGrid.ScrollRegionBase.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.RowScrollRegion.SetOriginAndExtent(Int32 origin, Int32 extent)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.ResizeRowScrollRegions()
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.DataAreaUIElement.set_Rect(Rectangle value)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.PositionChildElements()
   at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
   at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
   at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Parents Reply Children
No Data