OpenFileDialog default path

It seems like all you need to do is the following:

string path; // this is the path that you are checking.
if(Directory.Exists(path)) {
    openFileDialog1.InitialDirectory = path;
} else {
    openFileDialog1.InitialDirectory = @"C:\";
} 

That is unless I’m missing something.

Leave a Comment