Search code examples
c#.netwinformsdirectorycreate-directory

Provide folder name in creating folder


I am trying to create a folder with user provided name in a location in similar fashion of creating a file with user provided file name using SaveFileDialog in Windows Forms. The only option I have found to a create a folder is FolderBrowseDialog. Is there any alternative way I can get similar behavior like SaveFileDialog in saving folder?


Solution

  • No. There is no CreateDirectoryDialog in .NET. You either have to create it yourself, or use the FolderBrowseDialog.

    Your best option is to set FolderBrowserDialog.ShowNewFolderButton to true. It will work out-of-the-box and will adapt when Windows updates that dialog. If you think you have to improve that user experience, come up with something of your own.