C# 名称';crystalReportViewer';在当前上下文中不存在
我正在尝试使用c#加载rpt文件。 我使用了以下代码C# 名称';crystalReportViewer';在当前上下文中不存在,c#,crystal-reports,crystal-reports-xi,C#,Crystal Reports,Crystal Reports Xi,我正在尝试使用c#加载rpt文件。 我使用了以下代码 using System; using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; namespace Report { public partial class Report : Document { public void ReportLoad() { R
using System;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace Report
{
public partial class Report : Document
{
public void ReportLoad()
{
ReportDocument reportDocument = new ReportDocument();
string filePath = "D:\\crosstabReport.rpt";
reportDocument.Load(filePath);
crystalReportViewer.ReportSource = reportDocument;
}
但我收到一个错误,如“名称“crystalReportViewer”在当前上下文中不存在”
有什么建议吗
提前感谢
当前上下文中不存在名称“crystalReportViewer”
这意味着变量crystalReportViewer不在此范围内。检查您声明的名称,并在此处替换它。crystalReportViewer在哪里声明?