I open SaveFileDialog with the source directory based on the user path. I want to make sure that this path is valid before passing it and opening a dialog. Now I have this:
Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog(); if (!string.IsNullOrEmpty(initialDirectory) && Directory.Exists(initialDirectory)) { dialog.InitialDirectory = initialDirectory; } bool? result = dialog.ShowDialog();
However, it seems to \slip and cause a crash when calling ShowDialog. Are there other values that can cause failures? What rules should the InitialDirectory property follow?
\
A quick and easy way to fix this is to get the full path:
dialog.InitialDirectory = Path.GetFullPath(initialDirectory);
, SaveFileDialog. , , . , "/" ( , ) "" ( ).
SaveFileDialog
Source: https://habr.com/ru/post/1794956/More articles:ASP.NET MVC DropDownListFor с вложенными свойствами в модели - asp.net-mvcUnrecognized selector sent to instance - objective-cR x axis date label only one value - rSimple DropDownList in ASP.NET MVC3 Application - asp.netDesign patterns: many methods share the same first step - c #Chrome storage when freezing when playing HTML5 video - html5What is it: $ (function () {? - javascriptAndroid - привязка к сервису - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1794960/how-to-remove-nodes-using-html-agility-pack-and-xpath-so-as-to-clean-the-html-page&usg=ALkJrhgCKd0cqJw5pBFioCbEXuHeF6qFkQdjango external script ImportError: no module named Utils - djangoAll Articles