Solved

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

Posted on 2007-03-21
3
1,064 Views
Last Modified: 2013-11-26
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"
0
Comment
Question by:davidtrina
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Expert Comment

by:kerryw60
ID: 18767219
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
0
 
LVL 1

Author Comment

by:davidtrina
ID: 18768851
Ok... the .GDB "file" is in fact NOT a file it is a directory that I want to treat like a file
0
 
LVL 6

Accepted Solution

by:
kerryw60 earned 250 total points
ID: 18771023
Only other options are:

1) FolderBrowserDialog, but you cannot filter to show a "file" extention for folders.

2) Create your own custom control, with dialog, to behave how you want.

Very sorry I cannot help you further.

Good Luck!!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question