Solved

Directory Question

Posted on 2004-08-23
3
188 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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