Solved

Application path in vs2005 c#

Posted on 2010-11-22
11
670 Views
Last Modified: 2013-12-17
Hi,
how to retreive appication path in vs2005 c#?
thanks
0
Comment
Question by:bobdylan75
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 5

Assisted Solution

by:buraksarica
buraksarica earned 66 total points
Comment Utility
You can use :

string a = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

Open in new window

0
 
LVL 62

Assisted Solution

by:Fernando Soto
Fernando Soto earned 33 total points
Comment Utility

String appPath = Application.StartupPath;
0
 

Author Comment

by:bobdylan75
Comment Utility
sorry, perhaps I explain wrong..
Is this the path of my c# application opened?
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
It is the path to where the executable is located in the system.
0
 

Author Comment

by:bobdylan75
Comment Utility
FernandoSoto have I to add some "using" statement to call Application oblect?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
It is in System.Windows.Forms namespace and should be there by default on a Windows Form application.
0
 
LVL 6

Expert Comment

by:ajb2222
Comment Utility
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.  
0
 
LVL 5

Assisted Solution

by:buraksarica
buraksarica earned 66 total points
Comment Utility
AppDomain.CurrentDomain.SetupInformation.ApplicationBase is the best solution, also for the debugging purposes.
0
 

Accepted Solution

by:
roberto12cr earned 401 total points
Comment Utility
Try this:  Environment.CurrentDirectory
0
 

Author Comment

by:bobdylan75
Comment Utility
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??
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now