Has anyone trie using the BackgroundWorker component inside of ActionPanes
I spin up two panes in a Word Doc startup. Within the first pane, I start a long running action that when completed, updates data in the second pane. The issue is that within the RunWorker_Completed event, the executing thread is staying as the background thread, not switching back to the UI thread.
UIThread:1
backgroundWorker_DoWork:5
backgroundWorker_RunWorkerCompleted:5
When running the same code within a winform, I get the expected behavior:
UIThread:1
backgroundWorker_DoWork:5
backgroundWorker_RunWorkerCompleted:1
Any ideas

BackgroundWorker problems with VSTO
myaspng
ronin_blade_84
The thread executing the event handler for work completed is the background thread that was used to execute the do work, not the UI thread.
The article is of no further help, the bug (I am assuming - of course my code can't be wrong :p) seems to be how the backgroundworker executes differently whether in a winform or within Word.
Smartway
Using the information that you provided I too reproduced the behavior that you mentioned.
In my tests, I was simply trying to add text to a textbox control on the second user control and I also received a "Cross-thread error".
I was able to workaround the error and set the text property of the text box by using code from the following help topic
http://msdn2.microsoft.com/library/ms171728(en-us,vs.80).asp
Hope this helps!
Regards,
Ken Laws
Microsoft Support
This posting is provided "AS IS" with no warranties, and confers no rights.
For more information regarding Visual Studio Tools for Office 2005:
Best of Blogs: Visual Studio 2005 Tools for Office
http://msdn.microsoft.com/library/default.asp url=/library/en-us/odc_2003_ta/html/odc_landvsto2005_ta.asp
Visual Studio Tools for Office Forum
http://forums.microsoft.com/msdn/ShowForum.aspx ForumID=16
Visual Studio Tools for the Microsoft Office System
http://msdn.microsoft.com/office/understanding/vsto/default.aspx
jla6653
http://msdn2.microsoft.com/library/ms171728(en-us,vs.80).aspx