hi iam giving path to my crystal report
crystal reportviewer.reportsource="C:\\project\\myreport1.rpt";
but if i move to other system it will be a problem with the path
so i want to get the path of my application with c# code
how to do that...
Loading
Hirendra SisodiyaPosted Mar 29, 2010, 4:28 AM
you can place 'myreport1.rpt' on executable path(where your exe exists), and than use this line:
crystal reportviewer.reportsource= Application.StartupPath.ToString() + "\\myreport1.rpt";
thanks
Please mark as answere if it helps
Jaish MathewsPosted Mar 29, 2010, 4:12 AM
Below is the flexible method which can be used in both windows and web application.
Add the path value in configuaration file ie. app.config or web.config. The access the value from any where. Add Ref to "System.Configuration" library adn namespace.
string reportPath = ConfigurationManager.AppSettings["ReportPath"];
Sam HobbsPosted Mar 29, 2010, 3:43 AM
Environment.GetCommandLineArgs()[0]