Running ReportViewer report in another thread using BackgroundWorker

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top