OpenFileDialog - Filter out files with specific words

。_饼干妹妹 提交于 2020-01-07 02:17:27

问题


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?


回答1:


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.




回答2:


It is not possible with Basic OpenFileDialog's Filter property as it just filters list of files based on their extension.



来源:https://stackoverflow.com/questions/25625063/openfiledialog-filter-out-files-with-specific-words

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!