how to do copy & paste with folderbrowserdialog  
Author Message
MingMa





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

I have a folder path that I copy from other application. In my appliation, I want to open a dialog that I can paste the path to. folderbrowserdialog allows me to choose the folder to clicking through the folder tree structure, there is no way to allow me to enter a path directly. Is there a good way to work around this

Visual C#13  
 
 
David L





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

Well, with a FolderBrowserDialog you could set the SelectedPath property before you call the ShowDialog method. That way the user would start at whatever directory you want. For example:

folderBrowserDialog1.SelectedPath = ;

folderBrowserDialog1.ShowDialog();

Was that somewhat what you were looking for


 
 
MingMa





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

Thanks, David.

The problem is my program doesn't know which value to set to SelectedPath value. The value will come from the user. The users have several values to choose from other applications and hope they can just copy & paste the values into dialog box.

If you look at FileOpenDialog, there is an edit box you can copy the full path into, instead of navigating to that directory. I don't know why folderbrowserdialog doesn't have a address bar or something for people enter the path directly.


 
 
David L





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

Ahh, I see. I sort of missunderstood what you wanted to do.

Then I'm afraid I'm out of ideas. Of course, you could always build your own folderdialog form.


 
 
RizwanSharp





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

FolderBrowserDialog doesnot include any property which will show you a TextBox for pasting the path, To do that you can create your own by using System.IO.GetDirectories() and System.IO.GetFiles() functions and popluate the treee in your Custom Browser Form.

Best Regards,

Rizwan



 
 
Evan Mulawski





PostPosted: Visual C# Language, how to do copy & paste with folderbrowserdialog Top

Try using a TreeView with a Thread that builds the nodes with all of the files on your HDD.

foreach (File file in Directory.GetFiles("*.*"))

{

nodes.Add(file);

}

Then, use a drag and drop feature to File.Copy, then refresh the TreeView.

Does this work for you