im using a background worker to fill a dataset from a sql query and setting the datasource of the ultragrid to that dataset. i sometimes get an object not set to an instance error while doing this and i think it must do with setting the grid datasource. i saw the help here : http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=9838
but i am not using a collection as in the example. im not sure if i should be setting the datasource on the background thread or if i should fill the dataset on the background worker, and use the UI thread to bind the grid to the dataset. any help i would really appreciate. thanks
Using threads like this can be very dangerous. If the grid is bound to the data source and your code causes the data source to raise a notification which will pass over to the UI Thread without being properly marshalled.
The safest thing to do would be not to bind the grid to the data source until after the worker thread has completed and the data has been properly marhsalled to the UI Thread.
Hello,
I know this post is relatively old, but I have the same question. One thing I don't understand about your response is that it seems to defeat the purpose of using the background worker in the first place; if you wait until all the data is loaded into the collection before binding the data to the grid, then you could experience a delay (and a frozen UI) while the grid renders the data. What i'm looking for is some kind of design pattern I can apply to all similar projects, but the idea of using a background worker seems to run against the grain with the way that controls work these days with data sources (bind the data source and let the control take as long as it takes to load the data). Any insight would be much appreciated.