Why am I able to change UI(.text property) from my background worker

  • Thread starter Thread starter xxsomethingxx
  • Start date Start date
X

xxsomethingxx

Guest
Hi all,

Been working on integrating a backgroundworker on my application to help quicken the load of many controls(50+). Originally, i split the function up that housed the logic for all these controls into two separate functions - one to be run by the main UI thread and the other to be run on the backgroundworker. It ended up working out great and increasing load time and responsiveness of the window by several seconds(HUGE!!) but upon further research I learned I am to put any UI changes from the backgroundworker into the _progressChanged/runworkerCompleted event since it throws it back to the main UI thread so no crossing of threads will occur.


My question is, why was I able to succesfully change the .text properties of many controls on my backgroundworkers doWork event and have no issues? What would originally happen was I would see the main UI thread go through the normal function and populate all those fields on the form, then I would see the backgroundworkers DoEvent code run through and populate the rest. Just trying to get a sense of why no errors occured here. :)


Thanks!!

Continue reading...
 
Back
Top