Hi,
what is the correct way to show multiple reports in a separate thread each?
The reason is that we use modal windows, and when you show a report in a window and change to a different window, the open report is not responsive any more.
When shown in an own thread, it is.
In Reports.NET we used this code, which worked fine:
public static void ShowReport(StiReport rpt) //rpt already filled with data and rendered
{
if (rpt == null) return;
Thread threadShowReport = new Thread(new ParameterizedThreadStart(ShowReport));
threadShowReport.SetApartmentState(ApartmentState.STA);
threadShowReport.IsBackground = true;
threadShowReport.Start(rpt);
}
public static void ShowReport(object obj)
{
((StiReport)obj).Show(true);
}
Recently we changed to Reports.WPF, and on the second call an exception is thrown:
"the calling thread cannot access this object because a different thread owns it"
Please help!
Show reports in separate threads
-
- Posts: 5250
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show reports in separate threads
Hello,
Please send us a sample project that reproduces the issue for analysis.
Thank you.
Please send us a sample project that reproduces the issue for analysis.
Thank you.
Re: Show reports in separate threads
Here you are 

- Attachments
-
- ReportSample.zip
- (673.27 KiB) Downloaded 24 times
-
- Posts: 5250
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show reports in separate threads
Hello,
Thank you for the sample.
We need some time to investigate the issue, we will let you know about the result.
Thank you.
#9620
Thank you for the sample.
We need some time to investigate the issue, we will let you know about the result.
Thank you.
#9620
-
- Posts: 5250
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show reports in separate threads
Hello,
In your sample, you should change ShowDialog() on the Show() method.
Thank you.
In your sample, you should change ShowDialog() on the Show() method.
Thank you.
Re: Show reports in separate threads
I know this would work 
But we need ShowDialog in certain cases...

But we need ShowDialog in certain cases...
-
- Posts: 5250
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show reports in separate threads
Hello,
> But we need ShowDialog in certain cases...
Can you describe in more detail what for?
Thank you.
> But we need ShowDialog in certain cases...
Can you describe in more detail what for?
Thank you.