开发者

Display only text files openfiledialog

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜