ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Office Add-ins and threads (https://www.excelbanter.com/excel-programming/393130-office-add-ins-threads.html)

Tom

Office Add-ins and threads
 
Hi,

Is it possible to safely run threads in a VSTO Excel 2003 Add-in?

I run my thread as a STA thread like this:

thread = new System.Threading.Thread(TestThread);
thread.IsBackground = true;
thread.Name = "Test thread";

thread.SetApartmentState(System.Threading.Apartmen tState.STA);

I started to get "DisconnectedContext was detected" warnings from the
MDA right hafter I added a class library project to my add-in
solution.

Is there some magic trick to fix this or do I have to forget about
using threads and start calling Application.DoEvents every now and
then?

Br,
Tom



All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com