Solved

Directory Question

Posted on 2004-08-23
3
186 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
Comment Utility
You could use the GetExecutingAssembly.Location property

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

Accepted Solution

by:
Eamon21 earned 250 total points
Comment Utility
or
Application.StartupPath

Eamon
0
 

Author Comment

by:gvector1
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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