Solved

Directory Question

Posted on 2004-08-23
3
187 Views
Last Modified: 2010-04-15
I have an application that makes use of a configuration file and an open file dialog.  I actually make changes to some of the settings in the configuation file from a dll.  This dll is actually a class that allows me to modify my configuration file(xxxxx.exe.cfg).  My question is that once I use the open file dialog, the current directory is different than the location of the exe file and the configuration file.  Is there some way that from within that dll(which would be located in the same spot as the configuration file) I could find the applications default directory.  How could I do this other that making a public variable within the dll and setting that variable from within the application.  I would like the dll to be able to self determine the directory that the configuration file is located in.

Thanks,
Kendal
0
Comment
Question by:gvector1
3 Comments
 
LVL 2

Assisted Solution

by:lgawlik
lgawlik earned 250 total points
ID: 11876013
You could use the GetExecutingAssembly.Location property

see
System.Reflection.Assembly.GetExecutingAssembly.Location
0
 
LVL 1

Accepted Solution

by:
Eamon21 earned 250 total points
ID: 11879269
or
Application.StartupPath

Eamon
0
 

Author Comment

by:gvector1
ID: 11883952
I will split the points between the two answers. I prefer Application.StartupPath as it is simpler to implement over the long getexecutingassembly.location property, but lgawlik answered first.  I believe it's only fair to split the points.

Thank you both,
Kendal
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

21 Experts available now in Live!

Get 1:1 Help Now