我需要一个C#中的BrowseForFolder! [英] I need a BrowseForFolder in C#!
问题描述
我正在尝试找到可以用来获取浏览文件夹的课程。类似于SHBrowseForFolder的对话框,在C#中。我似乎找不到任何接近的东西。
我正在开发一个小型的小型应用程序,用于从我的数字音频分层组织创建M3U播放列表。我有应用程序工作,但我想让自己能够轻松选择起始文件夹(在我的文件服务器上)和输出文件夹(我家里各种PC和笔记本电脑上的本地文件夹)。一个OpenFileDialog就是不会做的伎俩。我需要BrowseForFolder对话框。 。 。 。但是没有在框架中找到它
我知道我可以创建一个带有TreeView和按钮的对话框来满足我的需求,但为什么要添加一个完整的逻辑树 - 和节点结构到一个程序的代码少于300行?正如大家现在所说的那样,为什么要重新发明轮子
感谢你们给予的任何帮助
Ryan T >
" Ryan Trevisol" < RY *********** @ bellsouth.net>在消息中写道
news:55 ********************************** @ microsof t.com我正在尝试找到可用于获取浏览文件夹的课程。类似于SHBrowseForFolder的对话框,在C#中。我似乎无法找到任何接近的东西。
System.Windows.Forms.FolderBrowserDialog browse =
new System.Windows.Forms.FolderBrowserDialog();
browse.ShowNewFolderButton = false;
browse.Description ="请选择一个文件夹;
browse.RootFolder = System.Environment.SpecialFolder .DesktopDirectory;
browse.SelectedPath =" apps";
if(browse.ShowDialog()== System .Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show("取消了);
-
C#newbie ...帖子可能不准确,不优雅或两者都
>
那只是1.1。如果您在1.0中,升级到1.1或在网站上找到一些来源。
http://support.microsoft.com/?kbid=306285
-Eric
这里有一句话,
这个类仅在框架的1.1版中可用。
问候,
Bram
" Bill Styles" <无***** @ nowhere.com>在消息中写道
news:ek ************** @ TK2MSFTNGP11.phx.gbl ..." Ryan Trevisol" < RY *********** @ bellsouth.net>在消息中写道
新闻:55 ********************************** @ microsof t.com < blockquote class =post_quotes>我正在尝试找到可以用来获取浏览文件夹的类。类似于SHBrowseForFolder的对话框,在C#中。我似乎无法找到任何接近的东西。
System.Windows.Forms.FolderBrowserDialog browse =
新的System.Windows.Forms.FolderBrowserDialog ();
browse.ShowNewFolderButton = false;
browse.Description ="请选择一个文件夹" ;;
browse.RootFolder = System.Environment.SpecialFolder .DesktopDirectory;
浏览.SelectedPath =" apps";
if(browse.ShowDialog()== System.Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show(" Cancelled");
-
C#newbie ...帖子可能不准确,不优雅或两者都
I''m attempting to find the class that I can use to get a "Browse For Folder" dialog similar to SHBrowseForFolder, in C#. I can''t seem to find anything that comes close.
I''m developing a small, small application to create M3U Playlists from my hierarchical organization of digital audio. I have the application working but I want to give myself the ability to easily select both the starting folder (on my file server), and the output folder (a local folder on my various PCs and laptops around the house). An OpenFileDialog just won''t do the trick. I need that BrowseForFolder dialog. . . . but haven''t found it in the Framework
I know I could create a dialog with a TreeView and buttons that would approximate my needs, but why should I add an entire logical tree-and-node structure to a program that''s got less than 300 lines of code? As everyone is saying these days, "why reinvent the wheel"
Thanks for any help you can give
Ryan T
"Ryan Trevisol" <ry***********@bellsouth.net> wrote in message
news:55**********************************@microsof t.comI''m attempting to find the class that I can use to get a "Browse For
Folder" dialog similar to SHBrowseForFolder, in C#. I can''t seem to
find anything that comes close.
System.Windows.Forms.FolderBrowserDialog browse =
new System.Windows.Forms.FolderBrowserDialog();
browse.ShowNewFolderButton = false;
browse.Description="Please select a folder";
browse.RootFolder=System.Environment.SpecialFolder .DesktopDirectory;
browse.SelectedPath = "apps";
if (browse.ShowDialog()==System.Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show("Cancelled");
--
C# newbie... posts are probably inaccurate, inelegant or both
That''s only in 1.1. If your in 1.0, upgrade to 1.1 or find some source on
the web.
http://support.microsoft.com/?kbid=306285
-Eric
Hi,
One remark here,
this class is only available in version 1.1 of the framework.
Greetings,
Bram
"Bill Styles" <no*****@nowhere.com> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl..."Ryan Trevisol" <ry***********@bellsouth.net> wrote in message
news:55**********************************@microsof t.comI''m attempting to find the class that I can use to get a "Browse For
Folder" dialog similar to SHBrowseForFolder, in C#. I can''t seem to
find anything that comes close.
System.Windows.Forms.FolderBrowserDialog browse =
new System.Windows.Forms.FolderBrowserDialog();
browse.ShowNewFolderButton = false;
browse.Description="Please select a folder";
browse.RootFolder=System.Environment.SpecialFolder .DesktopDirectory;
browse.SelectedPath = "apps";
if (browse.ShowDialog()==System.Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show("Cancelled");
--
C# newbie... posts are probably inaccurate, inelegant or both
这篇关于我需要一个C#中的BrowseForFolder!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!