3

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
Botz3000
  • 39,020
  • 8
  • 103
  • 127
jozef
  • 335
  • 1
  • 3
  • 15

1 Answers1

1

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

Community
  • 1
  • 1
Philipp Munin
  • 5,610
  • 7
  • 37
  • 60