2012-08-13 160 views
0

我是在C#中使用ReportViewer的新手。我正在尝试显示我使用水晶报表制作的报告。报告查看器不显示我分配的报告

这是我的代码:

private void button1_Click(object sender, EventArgs e) 
    { 
     ReportDocument cryRpt = new ReportDocument(); 
     cryRpt.Load("C:Users\\Document\\CrystalReport1.rpt"); 
     crystalReportViewer1.ReportSource = cryRpt; 
     crystalReportViewer1.Refresh(); 
    } 

这是错误消息:

'Microsoft.Reporting.WinForms.ReportViewer' does not contain a definition for 'ReportSource' and no extension method 'ReportSource' accepting a first argument of type 'Microsoft.Reporting.WinForms.ReportViewer' could be found (are you missing a using directive or an assembly reference?) 

我已经添加引用Interop.CrystalActiveXReportViewerLib10

我该如何解决这个问题?

+0

您忘记在加载命令 – vadim 2012-08-13 06:27:49

回答

0

尝试增加CrystalDecisions.ReportSource库。还有,你正在使用哪个版本的CR。

0

检查此程序集microsoft.reportviewer.winforms.dll是否已添加到您的项目中。