Directory Question

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.

Who is Participating?
Eamon21Connect With a Mentor Commented:

lgawlikConnect With a Mentor Commented:
You could use the GetExecutingAssembly.Location property

gvector1Author Commented:
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,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.