Results 1 to 6 of 6

Thread: Directory Dialog Box

  1. #1
    base836ball is offline VB.NET Forum Enthusiast
    .NET Framework
    Join Date
    May 2005
    Posts
    31
    Reputation
    119

    Directory Dialog Box

    Ive been looking online for a Directory Dialog Box. I'm on Vb.Net 2003 V1 and I have the File Open Dialog. Is there any way of coding it so it selects a directory instead.
    Thanks,

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,084
    Reputation
    1651
    Use the FolderBrowserDialog instead. Its already in your Toolbox.

  3. #3
    base836ball is offline VB.NET Forum Enthusiast
    .NET Framework
    Join Date
    May 2005
    Posts
    31
    Reputation
    119
    I do not have an FolderBrowserDialog nor do I have it when I look at my COM Components or .NET Framework

  4. #4
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,084
    Reputation
    1651
    I use Visual Studio, so maybe it isn't present in the Toolbox by default in Visual Basic. It is a member of the System.Windows.Forms namespace though, so you must be able to add it to the Toolbox if it isn't there already. Whether it is in the Toolbox or not, you can still create one in code:
    Code:
     Dim fbd As New System.Windows.Forms.FolderBrowserDialog
    		Dim selectedFolder As String
    
    		If fbd.ShowDialog() = DialogResult.OK Then
    			selectedFolder = fbd.SelectedPath
    		End If

  5. #5
    base836ball is offline VB.NET Forum Enthusiast
    .NET Framework
    Join Date
    May 2005
    Posts
    31
    Reputation
    119
    Didnt work. It says

    System.Windows.Forms.FolderBrowserDialog() is not defined

    Microsoft Development Environment 2002 Version 7.0

    Microsoft .NET Framework 1.0
    Not sure if the version matters but as you can see I dont have the folder browser dialog. Kinda funny.....

  6. #6
    kulrom's Avatar
    kulrom is offline VB.NET Forum All-Mighty
    .NET Framework
    .NET 3.5
    Join Date
    May 2005
    Location
    Republic of Macedonia
    Posts
    2,855
    Reputation
    267
    This control doesn't come with VS.NET 2002; but still you can find solution. There is an API control named SHBrowseForFolder

    you can find it here:
    http://www.dotnet247.com/247referenc...s/default.aspx

    under FolderBrowser Control

    Cheers

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking