Solved

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

Posted on 2007-03-21
3
1,070 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 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