INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

VB.Net - Windows Forms FolderBrowserDialog Not Opening

VB.Net - Windows Forms FolderBrowserDialog Not Opening

(OP)
I'm trying to present the user with a folder dialog to pick a destination directory when they click a button.

I can't get the sub that handles this to show the dialog.

I've stripped down my sub to just the following bare bones code and it still hangs and doesn't show the dialog. How can I debug this?

CODE

Private Sub Button13_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button13.Click
Dim folderBrowserDialog1 As New FolderBrowserDialog folderBrowserDialog1.ShowDialog()
End Sub

Thanks,
Jeff

RE: VB.Net - Windows Forms FolderBrowserDialog Not Opening

This works for me - Visual Studio 2015:

CODE

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim folderBrowserDialog1 As New FolderBrowserDialog

        folderBrowserDialog1.ShowDialog()

        'If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then
        '    MsgBox(folderBrowserDialog1.SelectedPath)
        'End If
    End Sub 

Try it with a brand new Project in VS just to test it.

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: VB.Net - Windows Forms FolderBrowserDialog Not Opening

(OP)
It works for me in a new project, but this is in some existing VB code which I am adding to.

Any idea what would cause it to trip up?

Jeff

RE: VB.Net - Windows Forms FolderBrowserDialog Not Opening

Since the FolderBrowserDialog class in System.Windows.Forms has such an awful user interface; maybe someone wrote their own version within the project you are working with and that custom version isn't working just right.

Try changing

CODE

Dim folderBrowserDialog1 As New FolderBrowserDialog
' to
Dim folderBrowserDialog1 As New System.Windows.Forms.FolderBrowserDialog 

and see if that makes any difference. If it does then you probably have a renegade version of FolderBrowserDialog somewhere in your project.

RE: VB.Net - Windows Forms FolderBrowserDialog Not Opening

(OP)
Nope, no other FolderBrowserDialog exists in the code.

As a "let's see what happens" I put an OpenFileDialog in place of the FolderBrowserDialog, and that worked. Unfortunately that doesn't let me return just a folder.

Sigh.
Jeff

RE: VB.Net - Windows Forms FolderBrowserDialog Not Opening

(OP)
I just wanted to circle back and let y'all know that I implemented code based on:

http://glassocean.net/how-to-create-a-treeview-fil...

in order to create my own folder dialog window that works when FolderBrowserDialog didn't.

Jeff

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close