开发者

Display only text files openfiledialog

开发者 https://www.devze.com 2023-03-06 03:07 出处:网络
I want to know how to filter out all files that 开发者_Python百科are not txt files in the open dialog in c#. I have been playing with this for ages and had no joy.Use the filter property:MSDN Filter

I want to know how to filter out all files that 开发者_Python百科are not txt files in the open dialog in c#. I have been playing with this for ages and had no joy.


Use the filter property: MSDN Filter

Here is a MSDN Walk through on how to Customize OpenFile Dialog

Here is an example:

openFileDialog.Filter = "Text|*.txt|All|*.*";

You can remove All if you dont want to give them an option to select other types of files:


Can't you use the .Filter property?

http://msdn.microsoft.com/en-us/library/system.windows.forms.filedialog.filter.aspx

Or did i misunderstand you?


OpenFileDialog.Filter property.

Documentation - MSDN OpenFileDialog Class

0

精彩评论

暂无评论...
验证码 换一张
取 消