Directory/Folder Views

  • Thread starter Thread starter Morgon
  • Start date Start date
M

Morgon

Guest
Ive spent a number of hours trying to research any controls, built-in, or custom, to allow for just Directory/Folder/Drive accesses, so that I may create and/or set a directory.. much like Winzips "Move Archive" function, or any other program out there that lists the computers directories (with things like "My Documents" and "My Network Places" special folders, as well)

I find it hard to believe something so used would have to be custom, with a bunch of lines of code... so I am almost convinced that Ive overlooked something.

Heellllppp!! :-)
-Morgon
 
There *is* something in the framework that allows this, but its hidden away. Search on Google for "FolderNameEditor". I havent used it beyond a quick example, but it works. It shows the folder selection dialog.
 
Apparently, the functionality for this was removed in post-Beta builds of VB.NET .. are you sure you got it to work (with a release version of VB.NET?)
All of the examples Ive found by searching Google come up with the same error: FolderNameEditor is not defined.

Have you, or anyone else reading this, found a way to get any sort of directory browser working? :-|

--Morgon
 
Its definitely there in the final, Ive had it working. You must not have referenced the correct assembly (System.Design.DLL I think).
 
re: Thinker

A lot of the parent classes use various "supporting classes" that Microsoft didnt feel like testing or documenting thoroughly, so they chuck this message in there to warn us. Based on my experience you can simply ignore the message and use the class anyway.

-CL
 
Namespace or type DLL for the Imports System.Design.DLL cannot be found. :-| .. Im not sure what else to do here.. this is completely ridiculous for MS to not provide some functionality for this upfront. Its in just about every program I use, in some form ..

Do you have your sample code handy anywhere, divil? Id love to see.. lol..

--Morgon


Originally posted by divil
Its definitely there in the final, Ive had it working. You must not have referenced the correct assembly (System.Design.DLL I think).
 
No I dont, sorry. That error would indicate what I said before, that you havent referenced the correct DLL. That doesnt just mean with an imports statement, you have to add the DLL to your project referenced too.
 
Thanks divil!!

Okay, for anyone whos been waiting for the final solution, I will be the nice one and put it all here :D

First, the class:
Code:
  Public Class clsFolderBrowser
        Inherits FolderNameEditor
        Dim mo_FB As New FolderBrowser()

        Public Sub New()
            MyBase.new()
            mo_FB.Style = FolderNameEditor.FolderBrowserStyles.RestrictToFilesystem
            mo_FB.StartLocation = FolderBrowserFolder.Desktop  Seems to be limited to this enumeration
        End Sub

        Public Sub ShowDialog()
            mo_FB.ShowDialog()
        End Sub

        Public ReadOnly Property DirectoryPath() As String
            Get
                Return mo_FB.DirectoryPath
            End Get
        End Property

        Public WriteOnly Property Description() As String
            Set(ByVal Value As String)
                mo_FB.Description = Value
            End Set
        End Property

    End Class

Then, you would normally call this from a button event to fill a textbox , so the code can be:
Code:
Dim fBrowser As New clsFolderBrowser()
fBrowser.Description = "Select a Folder"
fBrowser.ShowDialog()
If FB.DirectoryPath <> "" Then
      txtbox1.Text = FB.DirectoryPath
End IF

I hope this helps someone besides myself! Thanks to divil and everyone else who contributed :)

--Morgon
 
From the look of it...

Code:
Dim X As New clsFolderBrowser

X.ShowDialog()
Msgbox(X.DirectoryPath)
 
Back
Top