文件夹浏览器对话框
我在应用程序中使用文件夹浏览器对话框来选择文件夹。现在我想要这样的事情,在文件夹中应该只有 html 文件,没有其他文件可供选择。就像如果我们有打开文件对话框并且只想显示 html 文件,那么我们使用 openfiledialog 的过滤器属性。那么我如何在文件夹浏览器对话框中执行此操作以保留或仅选择文件夹中的 html 文件?
那就是如何在文件夹浏览器对话框中过滤文件?
编辑 仅选择包含 .HTML 的文件夹。
I am using Folder Browser Dialog in my application to select a folder. Now I want such a thing that in the folder there should be only html files nothing else to be selected. Like if we have open file dialog and only we want to display html file then we use filter property of openfiledialog.So how can I do that in folder browser dialog to remain or select only html files in the folder ?
That is how can I filter files in the folder browser dialog ?
EDIT select only folders containing .HTML.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您要求并在编辑中强调使用文件夹浏览器来选择文件。这是一个矛盾。只需使用带有 *.HTML 过滤器的 FileOpen 对话框即可。
也许您的意思是:仅选择包含 .HTML 的文件夹,但没有对此的内置支持。
编辑
您必须考虑这对于嵌套文件夹意味着什么。您需要至少向前看一级的内容,但任何子目录都可能包含 HTML 文件(向下几级)。
You are asking, and you emphasize in your Edit, to use a FolderBrowser to select files. That is a contradiction. Just use a FileOpen dialog with a *.HTML filter.
Maybe you meant: select only folders containing .HTML, but there is no built in support for that.
Edit
You'll have to think about what this means for nested folders. You would need something that looks ahead at least one level, but any subdir could potentially have HTML files (a few levels down).
使用它作为您的过滤器:
Use this as your filter:
选择文件时使用文件夹浏览器对话框有什么特殊原因吗?打开的文件对话框是可过滤的,应该是您用于文件选择的对话框。
要得到真正的答案:据我所知,不可能过滤文件夹浏览器对话框。
Is there any particular reason you would use a folder browser dialog when you're selecting a file? An open file dialog is filterable and should be what you're using for file selection.
To get to the real answer: afaik, it's not possible to filter the folder browser dialog.