folderbrowserdialog

C# - WPF - getting folder browser dialog without using System.Windows.Forms?

一笑奈何 提交于 2019-12-03 12:21:38
I have this WPF app and I want to have there function of getting a directory path from the user. I would like to use some folder browser dialog but I don't want to implement it from System.Windows.Forms or use some huge script inside. Is there some path getting dialog in WPF already implemented? I have read answers to similar questions here but it was full of System.Windows.Forms.. I haven't found anything like that in the Toolbox and I'm starting with WPF so I could use some help. Thank you in advance :] T Powers See my answer to Select folder dialog WPF . Basically the Windows Presentation

Exception when using FolderBrowserDialog

自古美人都是妖i 提交于 2019-12-03 05:44:09
问题 I'm getting the following Exception when trying to use FolderBrowserDialog: System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process. I have Googled this problem extensively and the solutions that everybody suggests seem to be to put [STAThreadAttribute] above the Main method, to

Exception when using FolderBrowserDialog

雨燕双飞 提交于 2019-12-02 19:05:36
I'm getting the following Exception when trying to use FolderBrowserDialog: System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process. I have Googled this problem extensively and the solutions that everybody suggests seem to be to put [STAThreadAttribute] above the Main method, to delete all dll's from the Debug folder, or to use the Invoke method. I have tried all of these, and I

Is it possible to use non-special folder as a FolderBrowserDialog's root folder?

£可爱£侵袭症+ 提交于 2019-12-01 22:09:15
FolderBrowserDialog.RootFolder Property is restricted to only special folder defined in the Environment.SpecialFolder enumerator. However in my applciation, we need to show this dialog, but the root path needs to be configurable, and is normally a custom folder, not related to any of the special folder in the enumerator. How can I show a folder browser with the root assigned to a custom folder? Maybe it's not possible with RootFolder property, but is it possible to have the same effect by other means (i.e. user can't view or select outside the root folder). In this answer , somebody hinted

Using FolderBrowserDialog on a Removable Device / Removable storage

流过昼夜 提交于 2019-12-01 19:54:39
I'm working on a simple copy tool to copy files off digital cameras. I've written the file copy code, I've got everything hooked up nicely. The issue I have seems to be with the FolderBrowserDialog. In Vista (I haven't checked XP yet), I can browse to the directories on the camera. However the FolderBrowserDialog will not let me select a directory on the camera. The OK button is greyed out. Looking at the path for the files on the camera it looks like this: Computer\[Camera Name]\Removable storage\AnotherDirectory\ As this is not a valid path (intead of C:\whatever), I'm guessing the

DialogResult with FolderBrowserDialog in WPF

 ̄綄美尐妖づ 提交于 2019-12-01 15:51:22
First time I'm implementing a FolderBrowserDialog in WPF and I'm not loving it one bit... Aside from the issues I had figuring out that Windows.Forms wasn't referenced in my project, now I'm having trouble trying to see what the DialogResult return value is... With an OpenFileDialog, in the past I've done it thusly: OpenFileDialog ofd = new OpenFileDialog(); Nullable<bool> result = ofd.ShowDialog(); if (result == true) { // all went well, carry on and do your thing here } Unfortunately, I'm now getting errors with this saying something about conversions from type DialogResult to bool and

Alternative to FolderBrowserDialog [closed]

巧了我就是萌 提交于 2019-11-29 03:41:17
Is there an alternative for selecting folders in C#? Optimally I'd like to use the OpenFileDialog to select folders, or at least something similar to that. Here you have and OpenFileOrFolder dialog and here another FolderBrowserDialog both Open Source. Sqrs Here's a trick that worked for me, it uses the SaveFileFolder Select Folder Path with savefileDialog Answer by Sqrs. The closest I found myself to what you may want is this: http://www.codeproject.com/Articles/15059/C-File-Browser This is a control that you can place on a dialog (form). It allows selecting files or folders. Here is what my

How to get file path from OpenFileDialog and FolderBrowserDialog?

被刻印的时光 ゝ 提交于 2019-11-28 19:21:57
Hey there i started learning C# a few days ago and I'm trying to make a program that copies and pastes files (and replaces if needed) to a selected directory but I don't know how to get the directory and file paths from the openfiledialog and folderbrowserdialog what am I doing wrong? Here's the code: namespace filereplacer { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void direc_Click(object sender, EventArgs e) { string folderPath = ""; FolderBrowserDialog directchoosedlg = new FolderBrowserDialog(); if (directchoosedlg.ShowDialog() == DialogResult

Required Dialog for selecting Multiple Files and Folders .NET

与世无争的帅哥 提交于 2019-11-28 11:58:58
I thought it would be easy to find, I was wrong. Dialog Requirements: Can browse MULTIPLE FILES/FOLDERS in the same time. Can be used in .NET windows forms. FREE or can be used under GPL. Works in Win Xp and Win 7. Dialog Preferences: C# Looks like OpenFileDialog in .NET. Has textbox for pasting path. I have tried few examples from WEB, none met all Requirements! Some examples, closest to solution for now: http://www.monkeybreadsoftware.net/class-opendialogmbs.shtml , it is no free http://www.codeproject.com/KB/dialog/FileDialogs.aspx , WIN7 problem Have you tried Ookii.Dialogs ? It should

Using environment variable in a file path

拈花ヽ惹草 提交于 2019-11-28 07:07:26
I've got an environment variable set that points to a specific folder (call it MYFOLDER for example). When typing in %MYFOLDER%\SubFolder into windows explorer the subfolder appears. However, when I pass SelectedPath = @"%MYFOLDER%\SubFolder"; to a FolderBrowserDialog , it doesn't work. I tried using Path.GetFullPath(..) , but this seems to return the bin folder of the executable (while debugging in VS) with %MYFOLDER% on the end, instead of the path I'd expect. Anyone know how to get it to use the environment variable properly? Expand it first: string path = Environment