I am trying to put a filter on my C# openFileDialog that excludes certain file extensions. For example I want it to show all files in a directory that are not .txt files.
Is there a way to do this?
I don't think this is possible. The way the filter is set up, is that you can choose which files to show, but I don't think there's a way to show "All files except...". Come to think of it, have you ever seen an Open File Dialog in Windows that has this? I don't think I've ever seen one.
Your best bet is to let them choose all files, and then prompt the user if they select one that isn't allowed OR filter it down to all the possible files that you can deal with.