I recently started using the latest version of Crystal Reports with both Visual Studio 2010 and SharpDevelop in a c# windows application (forms). I've downloaded the latest Crystal DLLs for Visual Studio 2010 from SAP and manually created references to the following
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
I then create a ReportDocument so that I can open a rpt file:
ReportDocument rptDoc = new ReportDocument();
this all compiles fine. The problem arises when I try to use the rtpDoc object to do anything;
rptDoc.Load(@"c:\DialLeadsByDistributor.rpt");
it's as if the compiler doesn't realize it's a class object, despite the fact that when I mouse over the variable it reports it properly as a CrystalDecisions.CrystalReports.Engine.ReportDocument
, but not only does intellisense not show me any methods or properties of the object, I get the following compiler error which has me stumped:
Invalid token '(' in class, struct, or interface member declaration
which references the above statement as the offending line...
Can anyone shed any light on this? If I look at the metadata for the ReportDocument class is does contain three Load methods, the first of which takes a string which is the rpt file path. The fact that this problem occurs in both Visual Studio 2010 and SharpDevelop is at least consistent, but still makes no sense to me.