locked
Select A Folder With Common Dialog In Visual Basic.NET 2013 RRS feed

  • Question

  • Hi , i have a question. Is there any way to Select a folder with Common Dialog ? I know i can select a folder with Folder Browser Dialog , But i don't want to use Folder Browser. Can i ? Can i select a folder with common dialog ? 
    I searched in a same forum , but i didn't find something useful.
    Did you see Visual Studio Project Location Dialog ? Something like that!




    Friday, August 22, 2014 9:27 AM

Answers

  • Try downloading this:

    https://www.nuget.org/packages/winapicp/

    The WinAPI codepack is a cool set of code and examples. One of the things it has is exactly what you are looking for, in a project sample called CommonFileDialogsDemo.

    Here is a screenshot of that sample using the "Open Dialog (select a folder)" button:


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Friday, August 22, 2014 6:35 PM
  • Try downloading this:

    https://www.nuget.org/packages/winapicp/

    The WinAPI codepack is a cool set of code and examples. One of the things it has is exactly what you are looking for, in a project sample called CommonFileDialogsDemo.

    Here is a screenshot of that sample using the "Open Dialog (select a folder)" button:


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Thank you , but  will it add to whole of the projects that already created or will create in future ?
    and another thing ... how to add to the project ?

    Hi Arshia,

    It will be added to your project, about how to add to your project, please refer to these official links:

    #Install NuGet
    http://docs.nuget.org/docs/start-here/installing-nuget

    #Then start using it to find and acquire your favorite libraries
    http://docs.nuget.org/docs/start-here/managing-nuget-packages-using-the-dialog


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Arshia Aghaei Monday, September 1, 2014 8:18 PM
    Monday, September 1, 2014 9:28 AM

All replies

  • Hi,

     No, there is only one dialog for selecting folders, the FolderBrowser dialog. You can`t use an OpenFileDialog unless you select a File and as far as i know there is no other dialog for selecting a folder. Of coarse, you could try designing your own dialog to do this but, it would be a bit of work.    8)


    If you say it can`t be done then i`ll try it

    • Proposed as answer by Cor Ligthert Friday, August 22, 2014 1:00 PM
    • Unproposed as answer by Arshia Aghaei Tuesday, September 2, 2014 10:00 AM
    Friday, August 22, 2014 10:11 AM
  • Go to Visual Studio 2013-->New-->Project--->Browse and you see one Folder Browser Dialog that it's very like common dialog. i mean that! how to create something like that?

    Friday, August 22, 2014 4:23 PM
  • Go to Visual Studio 2013-->New-->Project--->Browse and you see one Folder Browser Dialog that it's very like common dialog. i mean that! how to create something like that?

    Use a Dialog or Form.

    Remove all the code and controls from a Dialog if you use a Dialog. Then add code and controls as you go along.

    Unfortunately for some of the things displayed in the left window of your image, like Ease of Access or Control Panel those will be difficult to implement in my opinion.

    As far as the two large windows they are probably on something similar to a SplitContainer. Which probably has code in one of its events to alter the cursor to a double ended horizontal bar with arrow heads on each end so you can move the split left or right to increase or decrease the display area of either of the windows.

    You will need to create custom buttons if you want round buttons with arrow heads in them.

    For functionality of any of the controls you will need to provide that with code. If a control is to display folders like the window on the left then you will need to choose a control to use to do that and code it appropriately. That particular control is probably some form of a TreeView control.

    Although here's a link that may be helpful for you TreeView Explorer using VB.NET 2008 which actually displays Control Panel and Control Panels ICON in it.


    La vida loca



    Friday, August 22, 2014 4:44 PM
  • How to add whole computer folders to Tree View?
    And , how to get Tree View folder name ?

    Friday, August 22, 2014 6:03 PM
  • can you tell me how can i find a dialog like that? i mean a dialog that created before.
    Friday, August 22, 2014 6:06 PM
  • Try downloading this:

    https://www.nuget.org/packages/winapicp/

    The WinAPI codepack is a cool set of code and examples. One of the things it has is exactly what you are looking for, in a project sample called CommonFileDialogsDemo.

    Here is a screenshot of that sample using the "Open Dialog (select a folder)" button:


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Friday, August 22, 2014 6:35 PM
  • Try downloading this:

    https://www.nuget.org/packages/winapicp/

    The WinAPI codepack is a cool set of code and examples. One of the things it has is exactly what you are looking for, in a project sample called CommonFileDialogsDemo.

    Here is a screenshot of that sample using the "Open Dialog (select a folder)" button:


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Thank you , but  will it add to whole of the projects that already created or will create in future ?
    and another thing ... how to add to the project ?
    Thursday, August 28, 2014 10:42 AM
  • Try downloading this:

    https://www.nuget.org/packages/winapicp/

    The WinAPI codepack is a cool set of code and examples. One of the things it has is exactly what you are looking for, in a project sample called CommonFileDialogsDemo.

    Here is a screenshot of that sample using the "Open Dialog (select a folder)" button:


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com

    Thank you , but  will it add to whole of the projects that already created or will create in future ?
    and another thing ... how to add to the project ?

    Hi Arshia,

    It will be added to your project, about how to add to your project, please refer to these official links:

    #Install NuGet
    http://docs.nuget.org/docs/start-here/installing-nuget

    #Then start using it to find and acquire your favorite libraries
    http://docs.nuget.org/docs/start-here/managing-nuget-packages-using-the-dialog


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Arshia Aghaei Monday, September 1, 2014 8:18 PM
    Monday, September 1, 2014 9:28 AM
  • Try this :

    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Using SFD As New SaveFileDialog
                SFD.Title = "This is a faked Folder Locator, be sure to leave the filename intact"
                SFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer)
                SFD.FileName = "Placeholder.text"
                If SFD.ShowDialog = Windows.Forms.DialogResult.OK Then
                    TextBox1.Text = IO.Path.GetDirectoryName(SFD.FileName)
                Else
                    TextBox1.Text = "Nothing Selected"
                End If
            End Using
        End Sub
    End Class

    or this:

    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Using OFD As New OpenFileDialog
                OFD.Title = "This is a faked Folder Locator, choose any filename"
                OFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer)
                OFD.FileName = "Placeholder.text"
                OFD.AutoUpgradeEnabled = True
                If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then
                    TextBox1.Text = IO.Path.GetDirectoryName(OFD.FileName)
                Else
                    TextBox1.Text = "Nothing Selected"
                End If
            End Using
        End Sub
    End Class
    


    • Edited by Devon_Nullman Tuesday, September 2, 2014 4:02 AM Added alternate method
    Tuesday, September 2, 2014 1:36 AM