tags:

views:

214

answers:

1

Hi all,

I use the line below in my C# winform app, this works great but occasionally if the program is being run from the command line I get an error that the config.xml file cannot be found. This is because the 'working directory' is different (I think), I need to say "load config.xml from current directory", how would I do this?

docXML.Load("config.xml");

Thanks Jonathan

+3  A: 
string fileName = Path.Combine(Application.StartupPath, "config.xml");
Catalin DICU
Many thanks for this.
Jonathan Dyle