Advertisement

06.26.2008 at 08:39AM PDT, ID: 23518648
[x]
Attachment Details

Folder Browser Dialog does not display dialog window, always returns "Cancel"

Asked by kmoloney in Microsoft Visual Basic.Net, Visual Studio, .NET Framework 2.x

Tags: ,

I am trying to use the FolderBrowserDialog control in a simple windows forms application.  I only have two controls on a single form: txtFolder (textbox) and btnBrowseFolders (button).  Please see me code in the code snippet attached.

This code never displays a dialog box.  I just get a messagebox that shows "C:\Program Files" (because of the default SelectedPath value of SpecialDirectories.ProgramFiles).  Why isn't the dialog box appearing and allowing me to make a choice?

Thanks,

KevinStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Private Sub btnBrowseFolders_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseFolders.Click
 
        Dim theFolderBrowser As New FolderBrowserDialog
        theFolderBrowser.Description = "Please locate Directory..."
        theFolderBrowser.ShowNewFolderButton = False
        theFolderBrowser.RootFolder = Environment.SpecialFolder.Desktop
        theFolderBrowser.SelectedPath = My.Computer.FileSystem.SpecialDirectories.ProgramFiles
        If theFolderBrowser.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.txtFolder.Text = theFolderBrowser.SelectedPath
        Else
            MessageBox.Show(theFolderBrowser.SelectedPath)
        End If
[+][-]06.26.2008 at 08:55AM PDT, ID: 21876035

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 08:58AM PDT, ID: 21876068

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 08:58AM PDT, ID: 21876073

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:13AM PDT, ID: 21876235

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:22AM PDT, ID: 21876332

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:38AM PDT, ID: 21876511

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 10:59AM PDT, ID: 21877343

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 03:49PM PDT, ID: 21879729

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 03:53PM PDT, ID: 21879750

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 04:44PM PDT, ID: 21879959

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 04:48PM PDT, ID: 21879978

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 05:30PM PDT, ID: 21880181

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 05:34PM PDT, ID: 21880191

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 06:23PM PDT, ID: 21880371

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 08:02PM PDT, ID: 21880734

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, Visual Studio, .NET Framework 2.x
Tags: VB.NET / .NET Framework 2.05727, Firefox / IE
Sign Up Now!
Solution Provided By: kmoloney
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628