I'm having trouble loading an UltraGrid.
I'm loading it in a thread (There is potentially tens of thousands of records to be loaded into the grid),displaying the current records every 100 records.
I'm getting the error above when I do this. The grid dissapears and is replaced with a big red cross, and a message box pops up with this message in it (I'll spare copying and pasting the whole thing right now).
I have seen this error reported elsewhere in the forums, and the reply seems to be along the lines of "are you using the latest hotfix" and "Could you make a small sample and give it to support". Just to beat you to the punch, I am using the latest version (I was using v8.1, but upgraded to v8.2 and applied the latest hotfix 2022 in an attempt to fix it.
I'm thinking its not my coding - I have done this elsewhere in my application and it works fine. What is also weird is that I cant see anything different about the record it stops on (Yes I have found the exact record it stops on), and the record it stops on changes from time to time (usually after making changes to the sequence of coding).
Can anyone tell me whats going on here? Is this a coding fault on my behalf? Or an Infragistics bug?
---- EDIT -----
Just to be clear here - there is nothing wrong with the data. If I load the data in a similar way, but store it all in a list, and then assign this list to the grids datasource at once (rather than adding the newly retrieved records to the existing datasource), it works fine. I only get this error when adding more and more records to a grid which already has data in it.
Hi fweeee,
I doubt this has anything to do with a hot fix or a bug in the grid. The big red X most commonly occurs because the grid is bound to a data source that exists on a thread other than the UI Thread. When you use multiple threads, you have to be very careful to make sure that you properly marshal the data across the threads. If the grid receives a message from another thread that is not marshalled properly, it will cause all sorts of problems. This is not specific to the grid, it's true of any control.
My guess is that you binding the grid to a data source that is on a different thread and doing something that is causing the data source to raise a notification to the grid and the grid is responding to that notification immediately while it is in the middle of some other process.
Here's a Microsoft KB article that might help you out. The article is talking about the MS DataGrid, but the principle is the same for any control, as I said.
318604 - HOW TO Populate Datagrid on Background Thread with Data Binding by Using Visual Basic
Weird errors like that which occur seemingly at random are the hallmark of threading issues. :)
Thanks. Your right - it was to do with how I was doing the threading. This seemed a bit weird, as it wasnt crashing imediatly - it was letting me update the bindingsource/grid a few times, and then crash on the 5th attempt. Weird.
But yes - nothing to do with Infragistics. Thanks for your help.