A (hopefully) quick question. I have a VB.Net application linked to MS Access databases where the main form has 3 Data Grid Views presenting different cuts across scheduled manufacturing processes - one for "Pending" jobs, one for "Planned" jobs, and one showing a Machine Loading Summary for the next 10 working days.
I would like to use Background Workers to control the refresh of the data in these grids to provide better "performance" in the screen refreshes, because although not slow per se, I believe that the refreshing of the grids could be made to appear a lot faster using BGWs because data refreshes for the the three could in effect be done in parallel.
Anyway, I am clearly missing something because I keep getting a message about being "cross-threaded" or some such. I know that I cannot directly affect the "user interface" from the BGW, and that this must be done from the thread that instantiated the elements. I had a very simple version of BGW use working (based on something I found on the web), but this does not work here so that's why I think something is missing!
In simple terms what I want to do is populate my grids from a data set initially, and then when a refresh becomes due the BGW is activated, it generates an updated set of data, and when complete it notifies the main thread which then loads that data to the grid on screen and carries out the associated formatting (meaning that all manipulation of the UI is in the main thread).
Anyone able to in a few lines summarise what should be done where in the BGW events to achieve this, and what I need to add to the main thread ?? I am assuming that after the mainthread has called BGW.RunWorkerAsynch(), the population of the data is carried out in the BGW_DoWork() event, and when complete the BGW_RunWorkedCompleted() fires (I do not use the BGW_ProgressChanged() event as yet as I cannot see a reason for it at this point). Is it the RunWorkerCompleted() that actually refreshes the grid, or does this pass control to something else?? I think what I am asking (in a long winded way!!) is - "Is the RunWorkerCompleted() event part of the main thread or the background thread??"