current workin directory

  • Thread starter Thread starter worzel
  • Start date Start date
W

worzel

How do I have my win forms app find my configuration file. I want to have
this conf file stored in the same folder as the exectuable and simply refer
to it using a relative path. All seemed good untill I opened some files
using the "browse" dialog box - this seems to have changed my apps notion of
what the "relative" position of files is.

For now I have hard coded my conf file in c: drive. Of course, I can't
depend on this for the app coild be installed on many different machines,
which may or may not have c: as theri root drive.

How do folk refer to conf files that are to be distibuted with their apps in
windows forms? What is the methid for determining the current working
directory too?
 
How do I have my win forms app find my configuration file.

Is this the standard ExecutableName.exe.config file or a custom one?
If the former, you can simply check
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile. If not,
and you need the applications directory, check the
Application.StartupPath property.


Mattias
 
Is this the standard ExecutableName.exe.config file or a custom one?

Sorry, new to winforms - if there is some standard config file that allows
customisation, great. Where to find a good set of info on this? (likley to
have found a source by time you answer, but if you could reccomend any plain
english toots or references it would be good.

Thanks for the help
 
Thanks for the help - I am sure thsis will do the trick. Seems i have a few
options here.
 
Back
Top