Home Forums WinForms controls Xceed Grid for WinForms Updating a cell value from another thread Reply To: Updating a cell value from another thread

User (Old forums)
Post count: 23064


I also encountered this problem while building a multithreaded app using Xceed Grids to display the data. The problem occurs because your are modifying a user interface control from a thread other than the thread that owns its handle (in this case the main UI thread).

This is not possibile in windows forms. Even if the grid is bound to a datasource, and you modify the data source on a background thread then fire a list changed event to the grid you still (eventually) encounter this error or a variation of it.

The solution we settled on was doing as much of the processing as possible on the background thread and then doing the actual modification (via a databound collection) on the main UI thread using Invoke. The following links are quite good for this sort of thing. They are the three parts of a “Safe, Simple Multithreading in Windows Forms” set o f articles.


It does seem strange, as I would have thought that merely modifying the values would not interfere, but moving the updates onto the main UI thread solved this problem for us. And, thankfully, at the end of the day the performance hit was not significant, although it did make the code a bit more complex!

Hope this helps,

David Grant

Imported from legacy forums. Posted by David (had 3003 views)