C# .NET - how to load crystal report from current directory pathi.e from bin/deb

Asked By swati guij on 22-Mar-12 03:22 PM
how to load crystal report from current directory pathi.e from bin/deb
Somesh Yadav replied to swati guij on 26-Mar-12 01:24 AM
you need to add reference for crystal report while making the setup and deploy
Vikram Singh Saini replied to swati guij on 27-May-12 08:17 AM
You can use either of one:

(1) Application.StartupPath - that returns bin/Debug folder path.
(2) Environment.CurrentDirectory - that also returns bin/Debug folder path.

as shown in code snippet:

// new report document object
ReportDocument rpt = new ReportDocument();
           
string reportPath = Application.StartupPath + "\\" + "Client.rpt"; 
           
// loading the ItemReport in report document
rpt.Load(reportPath);