Code Snippets

  

VB.NET Source Code


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

Join 148,700 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,749 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: 27,569

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


There are currently no comments for this snippet. Be the first to comment!

Add comment


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




Be Social

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

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month