0

C# で ReportViewer を使用するのは初めてです。Crystal Reports を使って作成したレポートを表示しようとしています。

これは私のコードです:

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を追加しています

どうすればこれを解決できますか?

4

3 に答える 3

1

プログラムを機能させるには、CrystalDecisions.CrystalReports.Engineを参照として追加する必要があります。

VisualStudio2010のCrystalReportViewerコントロール

于 2012-08-13T06:33:20.957 に答える
0

CrystalDecisions.ReportSource ライブラリを追加してみてください。また、どのバージョンの CR を使用していますか。

于 2012-08-28T18:35:18.287 に答える
0

このアセンブリ microsoft.reportviewer.winforms.dll がプロジェクトに追加されているかどうかを確認してください。

于 2013-02-25T09:58:30.467 に答える