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??

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

Recommended Answers

All 3 Replies

you can create your own broserdialog to avoid that. but its not possible wth the orginal one.

From the Microsoft help for FolderBrowserDialog class:

Typically, after creating a new FolderBrowserDialog, you set the RootFolder to the location from which to start browsing. Optionally, you can set the SelectedPath to an absolute path of a subfolder of RootFolder that will initially be selected.

Are you possibly setting the SelectedPath to a location that doesn't equate to a subfolder of RootFolder (i.e. My Computer)? That would probably cause it to dive back to the RootFolder as the presented location.

folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyDocuments;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.