2017-10-11 129 views
0

我在Windows應用程序中使用Crystal Reports 14.2.2.1975和Visual Studio 2015。Crystal Reports:無法在查看器中刷新頁面或刷新

我已經能夠成功創建基於與DataTable匹配的字段定義的報告。該報告打印完美,並且可以正確預覽 - 但是 - 當試圖在查看器中使用刷新或分頁控件時,它會再次提示我輸入所有報告參數,然後顯示示例數據而不是請求的頁面。

設置查看器的代碼是從另一個對話框窗體(FrmPrint)調用的。在FrmPrint的 「預覽」 按鈕的相關代碼...

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() 

回答

0

原來,問題是最後一行:

frmReportPreview.Show() ' A modeless dialog 

當改爲:

frmReportPreview.ShowDialog() ' Making it modal 

..問題消失。