0
votes

I'm using Crystal Reports 14.2.2.1975 with Visual Studio 2015 in a Windows application.

I've been able to successfully create a report based on Field Definitions matched to a DataTable. The report prints perfectly, and will preview properly-- BUT-- when attempting to use either the Refresh or paging controls in the viewer, it prompts me for all report parameters again then displays sample data instead of the requested page.

The code which sets up the viewer is called from another dialog form (FrmPrint). The relevant code in FrmPrint's "Preview" button is...

Dim crxReport As New ReportDocument
crxReport.Load("<path>\Sample Report.rpt")

... 

<a dataTable (dt) is created and loaded with the proper data>

...


' Set the data source of the report to that dataTable
crxReport.Database.Tables(0).SetDataSource(dt)

' Prepare to preview the report 
(viewer contained on a separate form, "FrmReportPreview")
With FrmReportPreview 
    .Text = "My report name"
    .CrystalReportViewer1.ReuseParameterValuesOnRefresh = True
    .CrystalReportViewer1.ReportSource = crxReport
    .CrystalReportViewer1.Show()
End With

' Show the report preview window
FrmReportPreview.Show()
1

1 Answers

0
votes

It turned out the issue was the final line:

frmReportPreview.Show() ' A modeless dialog

When changed to:

frmReportPreview.ShowDialog() ' Making it modal

...the problem goes away.