0

Based on documentation: https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.filedialog.filter?view=net-5.0#examples

I can see filtering with 'OR' logic is possible:

Filter by "Word Documents" OR "Excel Worksheets" OR "PowerPoint Presentations" OR "Office Files" OR "All Files"

Filter = ".doc|.xls|.ppt|.doc;.xls;.ppt|.";

So character '|' is for 'OR' logic. Is there any character to use 'AND' logic ?

Example : "*.doc AND !somethingToIgnore.doc" to just ignore one file but take all other .doc files.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • Please don't spam irrelevant tags. –  Apr 19 '21 at 15:08
  • 4
    There is no boolean logic. The `Filter` contains a list of possible extensions and their descriptions. Nothing more. `|` is just a separator, used because it doesn't appear in file names or descriptions – Panagiotis Kanavos Apr 19 '21 at 15:14

1 Answers1

1

The and logic of a file extension would be to just list out the specific combined one like .docx.pptx (which doesn't make sense) or this .doc;.xls;.ppt which means one of these.

Like the comments above, theres no real logic here, just separators defining different patterns.

You can't exclude certain files from the OpenFileDialog. OpenFileDialog is for a user to select the file they wish to use.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
  • `You can't exclude certain files from the OpenFileDialog`, what certain files are these? – Trevor Apr 19 '21 at 15:26
  • 1
    @Codexer `somethingToIgnore.doc`, from the question. You can't exclude named files. –  Apr 19 '21 at 15:30
  • @RainbowDash thanks for the clarification, I was assuming file types, not named files :) – Trevor Apr 19 '21 at 15:32