pagego Posted September 30, 2003 Posted September 30, 2003 The following code opens a folder browser. Everything works fine, except if the user presses the 'cancel' button. Is there any way to support this? The error I get is "Arithmetic operation resulted in an overflow". This is because I try to load a varible from an io stream. Here's the code: Public Function BrowseForFolder(ByVal sTitle As String) As String Const WINDOW_HANDLE As Long = 0 Const NO_OPTIONS As Long = 0 Const BIF_NEWDIALOGSTYLE As Long = 64 Dim objShell As Object, objFolder As Object, objFolderItem As Object objShell = CreateObject("Shell.Application") objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, sTitle, NO_OPTIONS Or BIF_NEWDIALOGSTYLE, "My Computer") If Not objFolder Is Nothing Then objFolderItem = objFolder.Self BrowseForFolder = objFolderItem.Path End If objFolderItem = Nothing objFolder = Nothing objShell = Nothing End Function Quote
Wjousts Posted October 1, 2003 Posted October 1, 2003 Can you not use the FolderBrowserDialog object provided by the .NET framework? It's much easier to deal with. Quote
pagego Posted October 1, 2003 Author Posted October 1, 2003 I know but I need a way to browse for a folder in framework 1.0. Unless you have a better way Quote
*Experts* mutant Posted October 1, 2003 *Experts* Posted October 1, 2003 See if this article helps you: http://www.elitevb.com/content/01,0077,01/ Quote
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.