Hi,
I have a grid whose datasource is a datatable which is generated by a separate process. I very occasionally get the following exception thrown whilst this process is running and the binding is taking place. It does not seem to affect the stability of the application and I can carry on using the application without problem. I can also rerun the process to generate the datatable and populate the grid without any errors.
Looking at the exception stack it looks as though the error is occuring when the datatable is binding to the grid. Any ideas what it might be?
Thanks
Nish
Error: Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index
Error Details:Source: mscorlibStackTrace: at System.Collections.ArrayList.get_Item(Int32 index) at Infragistics.Shared.DisposableObjectCollectionBase.GetItem(Int32 index) at Infragistics.Win.UltraWinGrid.VisibleRowsCollection.get_Item(Int32 index) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean
recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered) at Infragistics.Win.ControlUIElementBase.get_CurrentCursor() at Infragistics.Win.UltraControlBase.get_Cursor() at System.Windows.Forms.Control.WmSetCursor(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)InnerException: Nothing
By "separate process", do you mean a separate thread? If so, you need to be extremely careful. If you do anything to the data source on a thread other than the UI thread and it causes the data source to send a notification to the grid, then this will end up crossing threads without properly marshalling and can cause all sorts of problems like exceptions.
Thanks for your response.
No - the 'seperate' process is running on the UI thread. By seperate process I meant a function that recalculates the data and the populates the grid.