<p>In a C# .NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using <code>System.Windows.Forms.FolderBrowserDialog</code> but that's a bit lame. Mainly because you can't type the path into it (so you need to map a network drive, instead of typing a UNC path).</p>

<p>I'd like something more like the <code>System.Windows.Forms.OpenFileDialog</code>, but for folders instead of files. </p>

<p>What can I use instead? A WinForms or WPF solution is fine, but I'd prefer not to PInvoke into the Windows API if I can avoid it.</p>

[{'answer_id': 45994, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 1, 'selected': False, 'text': '<p>Unfortunately there are no dialogs other than FolderBrowserDialog for folder selection. You need to create this dialog yourself or use PInvoke.</p>\n'}, {'answer_id': 46150, 'author': 'OwenP', 'author_id': 2547, 'author_profile': 'https://Stackoverflow.com/users/2547', 'pm_score': 0, 'selected': False, 'text': '<p>So far, based on the lack of responses to <a href="https://stackoverflow.com/questions/31059/how-do-you-configure-an-openfiledialog-to-select-folders">my identical question</a>, I\'d assume the answer is to roll your own dialog from scratch.</p>\n\n<p>I\'ve seen things here and there about subclassing the common dialogs from VB6 and I think this might be part of the solution, but I\'ve never seen anything about modifying what the dialog thinks it\'s selecting.  It\'d be possible through .NET via PInvoke and some other tricks, but I have yet to see code that does it.</p>\n\n<p>I <em>know</em> it\'s possible and it\'s not Vista-specific because Visual Studio has done it since VS 2003.</p>\n\n<p>Here\'s hoping someone answers either yours or mine!</p>\n'}, {'answer_id': 625057, 'author': 'Cheeso', 'author_id': 48082, 'author_profile': 'https://Stackoverflow.com/users/48082', 'pm_score': 6, 'selected': True, 'text': '<p>Don\'t create it yourself!  It\'s been done.  You can use <a href="http://dotnetzip.codeplex.com/SourceControl/changeset/view/29832#432677" rel="nofollow noreferrer">FolderBrowserDialogEx</a> - \na re-usable derivative of the built-in FolderBrowserDialog.  This one allows you to type in a path, even a UNC path.  You can also browse for computers or printers with it.  Works just like the built-in FBD, but ... better. </p>\n\n<p>Full Source code. Free.  MS-Public license.</p>\n\n<p><img src="https://i.stack.imgur.com/V1caf.png" alt="FolderBrowserDialogEx"></p>\n\n<p>Code to use it: </p>\n\n<pre><code>var dlg1 = new Ionic.Utils.FolderBrowserDialogEx();\ndlg1.Description = "Select a folder to extract to:";\ndlg1.ShowNewFolderButton = true;\ndlg1.ShowEditBox = true;\n//dlg1.NewStyle = false;\ndlg1.SelectedPath = txtExtractDirectory.Text;\ndlg1.ShowFullPathInEditBox = true;\ndlg1.RootFolder = System.Environment.SpecialFolder.MyComputer;\n\n// Show the FolderBrowserDialog.\nDialogResult result = dlg1.ShowDialog();\nif (result == DialogResult.OK)\n{\n    txtExtractDirectory.Text = dlg1.SelectedPath;\n}\n</code></pre>\n'}, {'answer_id': 17010941, 'author': 'Alex Essilfie', 'author_id': 117870, 'author_profile': 'https://Stackoverflow.com/users/117870', 'pm_score': 0, 'selected': False, 'text': '<p>After hours of searching for a similar solution I found <a href="https://stackoverflow.com/a/15456640/117870">this answer</a> by <a href="https://stackoverflow.com/users/353094/leetnightshade">leetNightShade</a> to <a href="http://www.lyquidity.com/devblog/?p=136" rel="nofollow noreferrer" title=".NET Win 7-style folder select dialog">a working solution</a>.</p>\n\n<p>There are three things I believe make this solution much better than all the others.</p>\n\n<ol>\n<li><strong>It is simple to use.</strong> \nIt only requires you include two files (which can be combined to one anyway) in your project.</li>\n<li>It falls back to the standard <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx" rel="nofollow noreferrer" title="FolderBrowserDialog Class (System.Windows.Forms)">FolderBrowserDialog</a> when used on XP or older systems.</li>\n<li>The author grants permission to use the code for any purpose you deem fit.\n\n<blockquote>\n  <p>There’s no license as such as you are free to take and do with the code what you will.</p>\n</blockquote></li>\n</ol>\n\n<p>Download the code <a href="http://www.lyquidity.com/devblog/?p=136" rel="nofollow noreferrer" title=".NET Win 7-style folder select dialog">here</a>.</p>\n'}]
['https://Stackoverflow.com/questions/45988', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1367/']