6

I have created Filter with this code:

saveFileDialog1.FileName = "SimplifiedLog";
saveFileDialog1.Filter = "RichTextFormate | *.rtf |Text Files | *.txt |All Files| *.*";
saveFileDialog1.Title = "Save Simplified KL File";
saveFileDialog1.ShowDialog();

The problem is that every time I select any filter (Other than the selected one) it adds extension in the previous one. See Picture below:Unwanted Filters

Flat Eric
  • 7,971
  • 9
  • 36
  • 45
Uzair Ali
  • 510
  • 14
  • 32

1 Answers1

9

You should remove the spaces:

saveFileDialog1.Filter = "RichTextFormate|*.rtf|Text Files|*.txt|All Files|*.*"; 

The spaces after and before | are evaluated as is, so you should not add them if not necessary.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325