【问题标题】:Crystal Reports: Can't Page or Refresh in ViewerCrystal Reports:无法在查看器中分页或刷新
【发布时间】:2017-10-11 22:49:10
【问题描述】:

我在 Windows 应用程序中使用 Crystal Reports 14.2.2.1975 和 Visual Studio 2015。

我已经能够根据与数据表匹配的字段定义成功创建报告。报告打印完美,并且可以正确预览 - 但是 - 当尝试在查看器中使用刷新或分页控件时,它会再次提示我输入所有报告参数,然后显示示例数据而不是请求的页面。

设置查看器的代码是从另一个对话框窗体 (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()

【问题讨论】:

    标签: crystal-reports


    【解决方案1】:

    原来问题是最后一行:

    frmReportPreview.Show() ' A modeless dialog
    

    当改为:

    frmReportPreview.ShowDialog() ' Making it modal
    

    ...问题消失了。

    【讨论】:

      猜你喜欢
      • 2012-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多