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...
How to get the path of application
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sam HobbsRank #107 · 20.5K reputationPosted Mar 28, 2010, 11:43 PM EDT
Environment.GetCommandLineArgs()[0]
Jaish MathewsRank #225 · 11K reputationPosted Mar 29, 2010, 12:12 AM EDT
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"];
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Mar 29, 2010, 12:28 AM EDT
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