Hello all:
App.config:
<add key="SaveDraftPath" value="C:\Drafts\"/>
C#:
var saveDraftPath = ConfigurationManager.AppSettings["SaveDraftPath"];
var sfDialog = new SaveFileDialog();
sfDialog.InitialDirectory = saveDraftPath;
sfDialog.FileName = "FILE";
For some reason this doesn't open the filebrowser in the path like planned, any one know why or how to fix?
I've tried this now, still doesn't work:
var saveDraftPath = Path.GetFullPath(ConfigurationManager.AppSettings["SaveDraftPath"]);
MessageBox.Show("does directory exist : " + Directory.Exists(saveDraftPath));
var sfDialog = new SaveFileDialog();
sfDialog.InitialDirectory = saveDraftPath;
sfDialog.FileName = "FILE";
and Directory.Exists(saveDraftPath) returns true.. Hmmm?!
Edit: The above code has worked once for me. The code works for everyone who has so far answered. But it is still not working. So I suspect the problem is some sort of local/history setting stopping it. Does anyone know why this might happen?