Link to home
Start Free TrialLog in
Avatar of davidtrina
davidtrina

asked on

Custom Open File Dialog in .NET to open a directory as a file

I am programming this in VB.NET 2005, Is there a way to use the open file dialog box to open a folder like a file?  Meaning, I am using a product that stores its databases in a directory with an extension example: MyDB.gdb, so if I use OpenFileDialog, it opens it like it would any other Directory I need to be able to tell it that .gdb is a file and when they click open it selects it like it would a File and return back a path to the "file"
Avatar of kerryw60
kerryw60

Not certain I'm following your question, but could you not:

With ofd
   .InitialDirectory = "C:\"
   .Title = "Select a database"
   .FileName = ""
   .Filter = "Database (*.gdb)|*.gdb
   .FilterIndex = 1
End With

If ofd.ShowDialog <> System.Windows.Forms.DialogResults.Cancel Then
   Dim strMyPath as String = ofd.FileName
   'Then whatever else you want to do...
End If
Avatar of davidtrina

ASKER

Ok... the .GDB "file" is in fact NOT a file it is a directory that I want to treat like a file
ASKER CERTIFIED SOLUTION
Avatar of kerryw60
kerryw60

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial