c# - Open File Dialog Initial directory -



c# - Open File Dialog Initial directory -

i have problem initialdirectory path used part of code shown below. opendialog show directory open file lastly time couldn't set new relative path.. tried set absolute path didn't work also.

private static string path = system.reflection.assembly.getexecutingassembly().location; public static string opendialog() { // create opendialog var dlg = new microsoft.win32.openfiledialog(); // initial directory openfiledialog need prepare if(directory.exists(path)) { dlg.initialdirectory = path; } dlg.restoredirectory = true;

in example, 'path' beingness set .exe, cause if (directory.exists(path)) fail, therefore, dialog open lastly known directory, because initialdirectory not set value want. seek hard-coding known directory path first. or prepare it:

path = directory.getparent(system.reflection.assembly.getexecutingassembly().location).fullname;

c# wpf dialog directory

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -