C# - 如何在 OpenFileDialog 中允许多种文件类型?

Posted

技术标签:

【中文标题】C# - 如何在 OpenFileDialog 中允许多种文件类型?【英文标题】:C# - How to allow multiple filetypes in an OpenFileDialog? 【发布时间】:2010-11-24 08:09:03 【问题描述】:

我曾经知道这一点,但我一直忘记;如何在 OpenFileDialog 的一个过滤器条目中允许多种文件类型?

Text files|*.txt          // this is OK.

Text files|*.txt,*.text   // how do I get this??

【问题讨论】:

【参考方案1】:

分号:

files|*.txt;*.text

【讨论】:

我怎样才能拥有 .pdf、.xls、.doc .. 过滤器会是什么? @Sangram 我很确定你只是输入了你自己的答案 @Sinaesthetic:哈哈。旧评论。是的,我确实回答了。

以上是关于C# - 如何在 OpenFileDialog 中允许多种文件类型?的主要内容,如果未能解决你的问题,请参考以下文章

c# winform 如何实现选择另一台电脑上目录下的文件??

c# 使用Openfiledialog的问题

c#中openfiledialog打开文件的问题

C#中openFileDialog1的问题

C#中SaveFileDialog 和OpenFileDialog 的用法

C# Winforms - 尝试通过将 FileDialogPermission 添加到 AppDomainSetup 来显示 OpenFileDialog