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
Post a Comment