cancel
Showing results for 
Search instead for 
Did you mean: 

How to render report asynchronous with WPF?

Former Member
0 Kudos

Hi

We use CR13 in a project. This is a WPF solution. How i can render the report asynchronous with the CrystalReportsViewer control?

When I start the form in a new thread, not the main UI thread, then crashed the CrystalReportsViewer control.

System.NullReferenceException was unhandled

Message: An unhandled exception of type 'System.NullReferenceException' occurred in SAPBusinessObjects.WPF.Viewer.dll

Additional information: Object reference not set to an instance of an object.

With this code work the CrystalReportsViewer, but the main UI is blocked.

public void OpenCrystalReport(ReportGeneratorModel model)

{

    if (Thread.CurrentThread == this.Dispatcher.Thread)

    {

        //show report in crystalreportviewer

        CristalReportForm frm = new CristalReportForm(model);

        if (model.ShowOnScreen)

        {

            frm.Show();

        }

    }

    else

    {

        Action<ReportGeneratorModel> delaget = this.OpenCrystalReport;

        this.Dispatcher.Invoke(delaget, new object[] { model });

    }

}

With this code we have a NullReferenceException.

public void OpenCrystalReport(ReportGeneratorModel model)

{

    //show report in crystalreportviewer

    CristalReportForm frm = new CristalReportForm(model);

    if (model.ShowOnScreen)

    {

        frm.Show();

    }

}

How to start the rendering nonblocking?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hello Roland

If you can attach a simple app that demos the issue, I can see about testing it and raising an escalation for a fix. Other than that, you'll have to create a phone incident here and have a support tech look at it with you.

To attach a file; zip up the project. Rename the zip to txt. Then click on Use advanced editor.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

OK. I ask my boss an see what I can do.

Former Member
0 Kudos

A simple demo app with a access db and an report.

The code for loading the data is uncomment. I have a logon failure by VerifyDatabase() and I know not why.

The password for the archive sent you via mail. But, I find not your email. (my mail: roland.schumacher at leuchterag.ch)

former_member183750
Active Contributor
0 Kudos

You can direct message me. Just hover over my icon or name and in the profile (at the bottom) there is an option to DM.

- Ludek

Answers (0)