I use SaveFileDialog to select the path where I want to save a file. I set InitialDirectory to some folder, but I want to limit the save locations to that folder or subfolders of that folder. Is this possible?
SaveFileDialog dialog = new SaveFileDialog();
dialog.InitialDirectory = "SomePath"//this is the path that I want to be root folder
No it is not possible.
You can’t directly set this as a Property on the
SaveFileDialog. But you can try to do it by using theFileOkevent to validate if the file is in that directory and otherwise cancel the event!As mentioned, the next best option is to build your own Dialog!