1

How do I filter files with a certain file extension from a list of files displaying in OpenFileDialog in C# Windows forms application?

I want the user to select a file, but with one rule: it mustn't be an .exe file. While I know that I can check the file name after the user selects it and display an error if it ends with .exe, it will display .exe files in the selection, which I don't want.

I know that user can select any file he wants if they type the name of the file in the input box in the OpenFileDialog, but I got that covered in a different way. I just don't want .exe files visible in the selection, since the user won't be allowed to select them anyway.

Shady Medic
  • 111
  • 11

0 Answers0