This is the code.
It has several options for the lisp function and you may want to modify it to add maybe the root folder etc...
You can view its functionality on Youtube to see if is something you like.
http://www.youtube.com/watch?v=Ug0k5...ature=youtu.be
Code:
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports System.Windows.Forms
''' <summary>
''' Folder Class to create a LISP Function to display the Folder Browser Dialog
''' In the System.Windows.Forms Class
''' </summary>
Public Class FolderClass
''' <summary>
''' LISP Function to display the Folder Browser Dialog
''' </summary>
''' <param name="rbfArguments"></param>
'''
''' <remarks>LISP Syntax
''' (folder) Default Selected Path is C:\\
''' (folder "C:\\") Sets the Selected Path to C:\\
''' (folder "C:\\" "Select Folder") Sets Description to "Select Folder"
''' (folder "C:\\" "Select Folder" T) Displays New Folder Button
''' </remarks>
<LispFunction("Folder")> _
Public Function Folder(ByVal rbfArguments As ResultBuffer)
Try
If rbfArguments Is Nothing Then Return Folder("C:\")
Dim arrArguments As TypedValue() = rbfArguments.AsArray()
Select Case arrArguments.Length
Case 0
Return Folder("C:\")
Case 1
Return Folder(arrArguments(0).Value.ToString)
Case 2
Return Folder(arrArguments(0).Value.ToString, arrArguments(1).Value.ToString)
Case 3
Return Folder(arrArguments(0).Value.ToString, arrArguments(1).Value.ToString, True)
End Select
Catch ex As System.Exception
End Try
Return Nothing
End Function
''' <summary>
''' .NET Function to display Folder Browser Dialog
''' </summary>
''' <param name="strSelectedPath"></param>
''' <param name="strDescription"></param>
''' <param name="blnNewFolderShow"></param>
''' <returns>Selected folder as string</returns>
Public Function Folder(Optional ByVal strSelectedPath As String = "", _
Optional ByVal strDescription As String = "", _
Optional ByVal blnNewFolderShow As Boolean = False)
Try
If strSelectedPath IsNot Nothing Then
Dim folderBrowserDialog As New FolderBrowserDialog
folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer
folderBrowserDialog.SelectedPath = strSelectedPath
folderBrowserDialog.Description = strDescription
folderBrowserDialog.ShowNewFolderButton = blnNewFolderShow
folderBrowserDialog.ShowDialog()
Return folderBrowserDialog.SelectedPath
End If
Catch ex As System.Exception
End Try
Return Nothing
End Function
End Class