VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

 

Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 300,308 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,104 people online right now. Registration is fast and FREE... Join Now!





Open a Folder Browse Dialog window

This will open a dialog window so that a user can browse to a specific folder.

Submitted By: Jayman
Actions:
Rating:
Views: 52,835

Language: VB.NET

Last Modified: August 16, 2006

Snippet


  1. ' First create a FolderBrowserDialog object
  2. Dim FolderBrowserDialog1 As New FolderBrowserDialog
  3.  
  4. ' Then use the following code to create the Dialog window
  5. ' Change the .SelectedPath property to the default location
  6. With FolderBrowserDialog1
  7.     ' Desktop is the root folder in the dialog.
  8.     .RootFolder = Environment.SpecialFolder.Desktop
  9.     ' Select the C:\Windows directory on entry.
  10.     .SelectedPath = "c:\windows"
  11.     ' Prompt the user with a custom message.
  12.     .Description = "Select the source directory"
  13.     If .ShowDialog = DialogResult.OK Then
  14.         ' Display the selected folder if the user clicked on the OK button.
  15.         MessageBox.Show(.SelectedPath)
  16.     End If
  17. End With

Copy & Paste


Comments


JimStiles 2009-06-12 13:15:41

This snippet looks exactly like what I believe I need. But, when I paste it into Access and run the code I get a compile error on the DIM statement "User Defined Type Not Defined." Am I missing something? Tx, Jim

Jayman 2009-06-12 14:47:16

This was not designed to run in Access, it is a Visual Basic .NET snippet.


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month