CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    35

    Folder Browser dialog

    Below code is opening Folder Browser dialog on button click, I want that if mine PC is in network..In Folder Browser Dialog even the network drives are coming,I want that Network Places do not come in treeview.Is it possible??


    Code:
    Option Strict On
    Option Explicit On
    Option Compare Text
    
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Try
                Dim obj As New FolderBrowserDialog
                If obj.ShowDialog = Windows.Forms.DialogResult.OK Then
                    MsgBox(obj.SelectedPath)
                End If
    
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub
    End Class

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Folder Browser dialog

    Try this
    Code:
    ' First create a FolderBrowserDialog object
    Dim FolderBrowserDialog1 As New FolderBrowserDialog
    
    ' Then use the following code to create the Dialog window
    ' Change the .SelectedPath property to the default location
    With FolderBrowserDialog1
        ' Desktop is the root folder in the dialog.
        .RootFolder = Environment.SpecialFolder.Desktop
        ' Select the C:\Windows directory on entry.
        .SelectedPath = "c:\windows"
        ' Prompt the user with a custom message.
        .Description = "Select the source directory"
        If .ShowDialog = DialogResult.OK Then
            ' Display the selected folder if the user clicked on the OK button.
            MessageBox.Show(.SelectedPath)
        End If
    End With
    After you press a ., you should see ALL the available options for the FB

    There is probably a flag for network drives.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured