什么是让用户选择在C#中的子目录的最佳方式? [英] What's the best way to let a user pick a subdirectory in C#?

查看:98
本文介绍了什么是让用户选择在C#中的子目录的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是让用户选择在C#中的子目录的最佳方式?

What's the best way to let a user pick a subdirectory in C#?

例如,一个应用程序,让用户组织所有他保存的HTML收据。他最有可能的是会希望能够选择一个根的子目录,该方案应搜索保存的网页(收据)

For example, an app that lets the user organize all his saved html receipts. He most likely is going to want to be able to select a root subdirectory that the program should search for saved webpages (receipts).

复制:

  • http://stackoverflow.com/questions/11767/browse-for-a-directory-in-c

推荐答案

文件夹浏览器对话框是要走的路。

如果你想设置一个初始文件夹路径,您可以将它添加到您的窗体Load事件:

If you want to set an initial folder path, you can add this to your form load event:

// Sets "My Documents" as the initial folder path
string myDocsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
FolderBrowserDialog1.SelectedPath = myDocsPath;

这篇关于什么是让用户选择在C#中的子目录的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆