Running ReportViewer report in another thread using BackgroundWorker

  • Thread starter Thread starter Charlie@CBFC
  • Start date Start date
C

Charlie@CBFC

Hi:

I'm trying to give user something to look at while a ReportViewer based
report runs. It takes a while because app connects to data over the
internet. Problem is report locks-ups when launched in DoWork event.
Backgoundworker seem to work with non-visual stuff. Is the problem because
report renders in a Window?

A simpler approach is just pop-up a nonmodal form and release after report
finishes. That works, but controls look transaparent.

Thanks,
Charlie
 
Are you running the report from the DoWork handler?

Problem is, you can't have children of a control/form if those children are
created in a different thread and you can't access control/form data from a
thread that didn't create the control/form. Which means you can use DoWork
to bring up another form if you want that form to have another form created
on the main thread as a parent. You shouldn't use DoWork for any UI work.
BackgroundWorker uses thread-pool threads to do it's work. ThreadPool
threads are created as MTA threads; WinForms requires threads to be created
(not changed to) as STA threads.

If the ReportViewer is a child of a form/control, there's not much you can do.
 
Back
Top