Im exporting a reports from dataset to a execel file,i have a lots of reports so it consuming me a lots of time,so I try to solve this by the background worker cuz I'm working on windows form application,but the new issue come,when begin excuting the report my form is not responding,I'm not able to move the form or click on the stop button(that stop the application).
this is a sample of my code :
#region x Report
PrimaryReportsThreads++;
ADIR_Parameters ADIR_Parms = ConfigManager.GetADIRParameters();
BackgroundWorker ADIR_worker = new BackgroundWorker();
AllThreads.Add(ADIR_worker);
ADIR_worker.DoWork += new DoWorkEventHandler(ADIR_worker_DoWork);
ADIR_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
ADIR_worker.RunWorkerAsync(ADIR_Parms);
#endregion
Sounds like COM issue. Probably you should try using MTA, instead of STA
Helpfull links:
http://msdn.microsoft.com/en-us/library/ms809971.aspx
http://msdn.microsoft.com/en-us/library/system.threading.apartmentstate.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With