Here is a folder browser that does not use the component.....
--------------------------------
Imports System.Windows.Forms.Design
Public Class BrowseForFolder
Inherits FolderNameEditor
Public Enum enuFolderBrowserFolder
Desktop = FolderBrowserFolder.Desktop
Favorites = FolderBrowserFolder.Favorites
MyComputer = FolderBrowserFolder.MyComputer
MyDocuments = FolderBrowserFolder.MyDocuments
MyPictures = FolderBrowserFolder.MyPictures
NetAndDialUpConnections =
FolderBrowserFolder.NetAndDialUpConnections
NetworkNeighborhood = FolderBrowserFolder.NetworkNeighborhood
Printers = FolderBrowserFolder.Printers
Recent = FolderBrowserFolder.Recent
SendTo = FolderBrowserFolder.SendTo
StartMenu = FolderBrowserFolder.StartMenu
Templates = FolderBrowserFolder.Templates
End Enum
'The FolderBrowserStyles collection is a member of FolderNameEditor
Public Enum enuFolderBrowserStyles
BrowseForComputer = FolderBrowserStyles.BrowseForComputer
BrowseForEverything = FolderBrowserStyles.BrowseForEverything
BrowseForPrinter = FolderBrowserStyles.BrowseForPrinter
RestrictToDomain = FolderBrowserStyles.RestrictToDomain
RestrictToFilesystem = FolderBrowserStyles.RestrictToFilesystem
RestrictToSubfolders = FolderBrowserStyles.RestrictToSubfolders
ShowTextBox = FolderBrowserStyles.ShowTextBox
End Enum
Public StartLocation As enuFolderBrowserFolder =
enuFolderBrowserFolder.MyDocuments '.BrowseForComputer
Public Style As enuFolderBrowserStyles =
enuFolderBrowserStyles.ShowTextBox
Private mstrDescription As String = "Please select a directory below:"
Private mstrPath As String = String.Empty
Private mobjFB As New FolderBrowser()
'Adds Description to dialog box
Public Property Description() As String
Get
Return mstrDescription
End Get
Set(ByVal Value As String)
mstrDescription = Value
End Set
End Property
Public ReadOnly Property Path() As String
Get
Return mstrPath
End Get
End Property
Public Function ShowBrowser() As System.Windows.Forms.DialogResult
With mobjFB
.Description = mstrDescription
.StartLocation = CType(Me.StartLocation,
FolderNameEditor.FolderBrowserFolder)
.Style = CType(Me.Style, FolderNameEditor.FolderBrowserStyles)
Dim dlgResult As DialogResult = .ShowDialog
If dlgResult = DialogResult.OK Then
mstrPath = .DirectoryPath
Else
mstrPath = String.Empty
End If
Return dlgResult
End With
End Function
End Class
--------------------------------
Usage is like....
--------------------------------
Dim objFB As New BrowseForFolder()
If objFB.ShowBrowser = Windows.Forms.DialogResult.OK Then
MessageBox.Show(objFB.Path)
End If
--------------------------------
"Grumpy Aero Guy" <fb@beerme.org> wrote in message
news:k5*****************@tornado.ohiordc.rr.com...
I have created an app that makes use of the FolderBrowserDialog.
Upon building the app, installing and running it, and invoking the form
using the dialog, it hangs upon folder selection and goes "not responding"
Upon debugging, it hangs as well upon executing the line that extracts the
selected folder without further explanation. All looks well in the
debugger prior to executing the line marked with <<<<<< below. When I
step over that line, it hangs.
With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop
.SelectedPath = Environment.SpecialFolder.Desktop
.Description = "Please select the desired template(s)..."
If .ShowDialog = DialogResult.Cancel Then
Exit Sub
End If
If .ShowDialog = DialogResult.OK Then
DestinationPath = .SelectedPath <<<<<<<<
End If
End With
I noticed the same behavior from a downloaded exe created in VS2005 using
the folderbrowser --- thus, I have two indenpent instances of the
browserdialog hanging, one not of my creation.
Any insights?
--
Grumpy Aero Guy