We help IT Professionals succeed at work.

Path to file in project

JRockFL
JRockFL asked
on
Medium Priority
275 Views
Last Modified: 2010-04-23
How can I get the entire path to a file in the project?
For example, settings.xml

Instead of hard coding C:\Documents and Settings\... etc

Comment
Watch Question

IT Pro/Developer
CERTIFIED EXPERT
Top Expert 2008
Commented:
Environment.CurrentDirectory will give you the path of your project (where is the exe file)
Use:

Application.StartupPath & "settings.xml"

eg...

Messagebox.Show(Application.StartupPath & "settings.xml")

Open in new window

Author

Commented:
Thank you!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.