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
45
Refresh UltraWinGrid bound to DataSet in BackgroundWorker?
posted

I hate to start another thread on this, but I would like to know if this is viable or not.  I have a readonly grid bound to a DataSet containing one or more DataTables.  If I periodically launch a BackgroundWorker that returns a new DataTable with matching schema, can I update the the grids bound DataSet via DataSet.Merge(returned DataSet)?

This technique is locking up our UI thread in some instances as soon as the BackgroundWorker starts, but I cannot figure out why.  I am only passing strings into the RunWorkerAsync() function, creating all local objects in the DoWork() function, and returning a new DataSet back to the UI thread via the RunWorkerCompleted Result argument.  I am not updating the grid datasource at all until the RunWorkerCompleted event.

It seems that if I mouseover certain parts of the grid or activate new rows while the BackgroundWorker is running, the UI freezes.  Am I missing something in my code, or is this pattern simply not supported?

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Ron,

    It's hard to say for sue without seeing the code in action. Does your background worker thread still have a reference to the DataSet after it returns it?

    I can't say I'm that familiar with RunWorkerCompleted. If you check grid.InvokeRequired inside of that event, does it return true? If so, then you need to marshal the DataSet back to the UI thread, in which case, the UI thread could be locked for a long time if the DataSet is fairly large.

Children