Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenFile Dialog

0 views
Skip to first unread message

james

unread,
Jul 8, 2003, 4:42:47 PM7/8/03
to
Is it possible to get the Folder instead of the file in the OpenFileDialog?
It will not allow an OK/Open unless a file is clicked, but I want a Folder

Thanks,

JIM


Jeremy Cowles

unread,
Jul 8, 2003, 2:46:11 PM7/8/03
to
"james" <nos...@hypercon.net> wrote in message
news:uiq48CY...@TK2MSFTNGP10.phx.gbl...

> Is it possible to get the Folder instead of the file in the
OpenFileDialog?
> It will not allow an OK/Open unless a file is clicked, but I want a Folder

Use the OpenFolderDialog (.NET 2003), or call the OpenFolderDialog API. I
don't have a C# implementation of the API to post, sorry.

Jeremy

james

unread,
Jul 8, 2003, 5:09:37 PM7/8/03
to
Ok, thanks, I am not on 2003 yet :-(

JIM


"Jeremy Cowles" <jeremy.stop-s...@asifl.com> wrote in message
news:TjEOa.47028$bK5.1...@twister.tampabay.rr.com...

André Dias

unread,
Jul 8, 2003, 3:48:31 PM7/8/03
to
private void btnBrowseDirectory_Click(object sender, System.EventArgs e)
{   
 txtDirectory.Text = new OpenDirectoryDialog().browseDialog("Select a source directory");     
}
 
 
 
Class: OpenDirectoryDialog
==================
using System;
using System.Windows.Forms;
using System.Windows.Forms.Design;
 
public class OpenDirectoryDialog : FolderNameEditor
{
 FolderNameEditor.FolderBrowser bDialog;
     
 public OpenDirectoryDialog()
 {
  bDialog = new FolderNameEditor.FolderBrowser();
 }
     
 public string browseDialog(string sTitle)
 {
  bDialog.Description = sTitle;
  bDialog.StartLocation = FolderNameEditor.FolderBrowserFolder.Desktop;
  bDialog.Style = FolderNameEditor.FolderBrowserStyles.RestrictToDomain;
  bDialog.ShowDialog();
  return bDialog.DirectoryPath;
  
 }
 
 ~OpenDirectoryDialog()
 {
  bDialog.Dispose();
 }
}

Jeremy Cowles

unread,
Jul 8, 2003, 3:58:05 PM7/8/03
to
Here is an API implementation in VB.NET, it is nasty, but with only a little
work, it should run in C#.

Jeremy


"james" <nos...@hypercon.net> wrote in message

news:OjCJ9RYR...@TK2MSFTNGP11.phx.gbl...

james

unread,
Jul 8, 2003, 8:52:49 PM7/8/03
to
Thanks

JIM


"Jeremy Cowles" <jeremy.stop-s...@asifl.com> wrote in message

news:hnFOa.47092$bK5.1...@twister.tampabay.rr.com...

james

unread,
Jul 8, 2003, 8:53:06 PM7/8/03
to
Thanks
 
JIM

0 new messages