Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 131,863 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,525 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: 24,924

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.





Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month