The following code will instantiate a specific Crystal report (TestRpt.rpt):
public static void CreatePDF()
{
DataSet ds = TestDAL.GetCrystalDS();
TestRpt rpt = new TestRpt();
rpt.SetDataSource(ds);
rpt.ExportToDisk(ExportFormatType.PortableDocForma t, "TestRpt.pdf");
}
However, I would like to generalize this so the report name can be passed
in... something like this (although I realize this won't work, but you get
the idea):
public static void CreatePDF(string reportName)
{
DataSet ds = TestDAL.GetCrystalDS();
ReportName rpt = new ReportName(); <<< how would I do something like
this at runtime?
rpt.SetDataSource(ds);
rpt.ExportToDisk(ExportFormatType.PortableDocForma t, ReportName +
".pdf");
}