how to open a specific directory from VB.Net

mariano_donati

Active member
Joined
Nov 30, 2005
Messages
41
Programming Experience
Beginner
Hi, I need to open a directory, let's say "C:\Received Files" from a button of my application. Is it possible to do it without using windows API?.

Any tip/comment/question/info will be appreciated.
Thank you all very much.
 
well there's the FolderBrowserDialog for finding folders and there's the OpenFileDialog for finding files

but if you already know the location then you can use System.IO.Directories.Exist("C:\Received Files") to see if the folder exists or not
 
But I don't need to know if it exists, I need to open that direcory to let the client select the file that he wants to open. I need to open the windows explorer and locate it in that specific directory, is it possible?

Regards!.
 
you can use the OpenFileDialog for this:
VB.NET:
Dim ofd As New OpenFileDialog
With ofd
  .FileName = "C:\Received Files" 'Points it to the received files folder
  .Title = "Locate File"
  .Filter = "All Files (*.*)|*.*"
End With
If ofd.ShowDialog() <> DialogResult.Cancel Then
  'Use ofd.FileName to manipulate the file the user selected
End If
 
Well, that would be great, but once the user has selected the file, I need to open it with its respective application. For example, if user selects a jpg image, then when he selects this file on FileDialog control then I don't need to manipulate the file in my application, but open it with the default application. So if it's an image, I want to open PhotoShop when user has selected the file, or if the file is a Microsoft Word document, then open Microsoft Word application for viewing the file.
I can imagine that doing that from my application might be a really difficult task for me. For that reason I want to know if there's a posibility to open windows explorer, and locate it in a specific directory. Just as Windows Messenger does when you receive a file... Did you see that messenger put you a link to the directory where you keep all files that you have received?, well, that's what I'm trying to do.
Thanks for your patience.
 
Back
Top