Application path in vs2005 c#

Hi,
how to retreive appication path in vs2005 c#?
thanks
bobdylan75Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

buraksaricaCommented:
You can use :

string a = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

Open in new window

Fernando SotoRetiredCommented:

String appPath = Application.StartupPath;
bobdylan75Author Commented:
sorry, perhaps I explain wrong..
Is this the path of my c# application opened?
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Fernando SotoRetiredCommented:
It is the path to where the executable is located in the system.
bobdylan75Author Commented:
FernandoSoto have I to add some "using" statement to call Application oblect?
Fernando SotoRetiredCommented:
It is in System.Windows.Forms namespace and should be there by default on a Windows Form application.
ajb2222Commented:
if you want the path to the actual executable file with the executable name you use  Application.ExecutablePath

if you only want the path to the executable you would use Application.StartupPath.  
buraksaricaCommented:
AppDomain.CurrentDomain.SetupInformation.ApplicationBase is the best solution, also for the debugging purposes.
roberto12crCommented:
Try this:  Environment.CurrentDirectory

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobdylan75Author Commented:
sorry but the only solutuion that works is the roberto12cr's one.
parhaps due to my app isn't a windows app but only a console app??
Fernando SotoRetiredCommented:
Be careful not to change the current working directory in your program because if you do it will no longer point to where the executable is running from.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.