我是在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
我該如何解決這個問題?
您忘記在加載命令 – vadim 2012-08-13 06:27:49