none
Type a location FolderBrowserDialog RRS feed

  • Question

  • Hi all -

    I apologize if this question is utterly simplistic.

    I've been building a Windows Forms project.  At some point, the user will click a browse button which will open a folderBrowserDialog to specifiy a location to save files to.  However, some functionality that I would like doesn't exist (it appears).  Most likely, the user will be saving the files to a server ie: \\testserver\folder1\saveHere

    I have tried opening the Network option in the folderBrowserDialog but the servers that would be saved to are not listed there.
    (Yes the servers are accessible -- currently the path is hard coded and the files are saved there no problem).

    I have played with the openFileDialog and found that in the text field I can type something like \\testserver and hit enter and then the folders on \\testserver are loaded for me to navigate.  However, the openFileDialog won't let me select a folder, only files.


    So basically I want to know is there a way to mimic this openFileDialog behavior in a folderBrowserDialog or is there a way to force the openFileDialog to select folders instead of files?

    Any help is much appreciated.  Thanks

    Wednesday, July 15, 2009 2:38 PM

Answers

  • Hi – Archimedes0212:       

    I can only find one solution, which allows you to type in, and that is: Use the ComboBox control. It should work.

    Properties:
    Set its properties as follow.

    AutoCompleteMode = Suggest
    AutoCompleteSource = AllSystemSources

    I hope this information was helpful…

    Have a nice day…

    Best regards,
    Fisnik

    Feedback
    If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at
    fbmsdn@microsoft.com.


    Coder24.com
    Wednesday, July 15, 2009 3:55 PM

All replies

  • Hi – I think my information can help:

    Well, it works correctly for me, except that I’m not doing the same thing (as you). I think, you should pass a string variable.



    I hope this information was helpful…

    Have a nice day…

    Best regards,
    Fisnik

    Feedback
    If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at
    fbmsdn@microsoft.com.

     


    Coder24.com
    Wednesday, July 15, 2009 3:28 PM
  • Hi Coder24 -

    Your code retrieves the selected path from the folderBrowserDialog.  This isn't quite what I'm looking for.  My problem is not in the retrieval of the path that the user selected, but in getting to a specific path.

    The folderBrowserDialog object does not support having a text field that the user can manually type a location into, which is one of my issues.  The user will most likely be navigating to a server location that does not appear in the Network drop down.
    Typing into the text field in an openfiledialog object gets me to that server location.  However, since that text field does not exist in a folderbrowserdialog, I'm stranded at the moment.

    Does anyone have any ideas on how to solve this problem?? Thanks.
    Wednesday, July 15, 2009 3:35 PM
  • Hi – Archimedes0212:       

    I can only find one solution, which allows you to type in, and that is: Use the ComboBox control. It should work.

    Properties:
    Set its properties as follow.

    AutoCompleteMode = Suggest
    AutoCompleteSource = AllSystemSources

    I hope this information was helpful…

    Have a nice day…

    Best regards,
    Fisnik

    Feedback
    If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at
    fbmsdn@microsoft.com.


    Coder24.com
    Wednesday, July 15, 2009 3:55 PM
  • Thanks Coder24 -

    I'll give that a try!
    Wednesday, July 15, 2009 4:01 PM
  • do you wish to set the root folder for your dialog box?

    folderBrowserDialog1.RootFolder

    student,UH
    Wednesday, July 15, 2009 8:36 PM
  • hi Vayuu -

     No, setting the rootFolder is easy.  It's just the navigation to unlisted servers that is still causing the problem
    Thursday, July 16, 2009 2:11 PM
  • Coder24.com

    Thanks for this idea.  It seems like it's the best thing that I'm going to get.

    For anyone else that stumbles across this - coder24's response works perfectly.  I made a few alterations to this.

    Instead of AutoCompelteMode = Suggest, I set it to SuggestAppend -- the suggestions will stay until you leave the control.
    Also, this method works for other controls, not just the ComboBox.

    For example, I'm using this on a textbox, and it works perfectly fine.  (The one draw back is that the suggestions are limited to folders that the user has explored already)

    Other than that, this is a fine solution.
    Thursday, July 16, 2009 2:18 PM