Guest Morgon Posted June 26, 2002 Posted June 26, 2002 I've 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 Winzip's "Move Archive" function, or any other program out there that lists the computer's 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 I've overlooked something. Heellllppp!! :-) -Morgon Quote
*Gurus* divil Posted June 26, 2002 *Gurus* Posted June 26, 2002 There *is* something in the framework that allows this, but it's hidden away. Search on Google for "FolderNameEditor". I haven't used it beyond a quick example, but it works. It shows the folder selection dialog. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest Morgon Posted June 26, 2002 Posted June 26, 2002 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 I've 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 Quote
*Gurus* divil Posted June 26, 2002 *Gurus* Posted June 26, 2002 It's definitely there in the final, I've had it working. You must not have referenced the correct assembly (System.Design.DLL I think). Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Gurus* Thinker Posted June 26, 2002 *Gurus* Posted June 26, 2002 It is documented in MSDN, but it has a strange message I don't understand. This type supports the .NET Framework infrastructure and is not intended to be used directly from your code. Quote Posting Guidelines
*Gurus* Derek Stone Posted June 26, 2002 *Gurus* Posted June 26, 2002 re: Thinker A lot of the parent classes use various "supporting classes" that Microsoft didn't 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 Quote Posting Guidelines
*Gurus* Thinker Posted June 26, 2002 *Gurus* Posted June 26, 2002 Ok CL, I actually trust your advice as much or more than anything I read. Quote Posting Guidelines
Guest Morgon Posted June 27, 2002 Posted June 27, 2002 'Namespace or type 'DLL' for the Imports 'System.Design.DLL' cannot be found.' :-| .. I'm 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? I'd love to see.. lol.. --Morgon It's definitely there in the final, I've had it working. You must not have referenced the correct assembly (System.Design.DLL I think). Quote
*Gurus* divil Posted June 27, 2002 *Gurus* Posted June 27, 2002 No I don't, sorry. That error would indicate what I said before, that you haven't referenced the correct DLL. That doesn't just mean with an imports statement, you have to add the DLL to your project referenced too. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest Morgon Posted June 27, 2002 Posted June 27, 2002 Thanks divil!! Okay, for anyone who's been waiting for the final solution, I will be the nice one and put it all here :D First, the class: 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: 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 Quote
*Gurus* divil Posted June 27, 2002 *Gurus* Posted June 27, 2002 From the look of it... Dim X As New clsFolderBrowser X.ShowDialog() Msgbox(X.DirectoryPath) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.