OpenFileDialog-用特定的单词过滤掉文件 [英] OpenFileDialog - Filter out files with specific words

查看:336
本文介绍了OpenFileDialog-用特定的单词过滤掉文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以编写一个自定义对话框来执行所需的操作,但是可以使用OpenFileDialog设置过滤器来获取.txt文件,但前提是文件名中没有"_org" ?

I know I can write a custom dialog to do what I'm looking for, but is it possible to set a filter with OpenFileDialog to get .txt files, but only if they doesn't have "_org" in the filename?

推荐答案

嘿,您可以订阅OpenFileDialog.FileOk-Event来检查用户对文件名的选择.如果任何文件名不正确,您可以取消该事件并显示一条消息!否则,您必须编写一个自定义对话框.

Hey you can subscribe the OpenFileDialog.FileOk-Event to check the user selection of file names. if any filename incorrect you can cancel the event an show a message! otherwise you must write a custom dialog.

这篇关于OpenFileDialog-用特定的单词过滤掉文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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