Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use filter of SaveFileDialog

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

like image 731
Uzair Ali Avatar asked May 04 '14 10:05

Uzair Ali


1 Answers

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.

like image 129
Patrick Hofman Avatar answered Nov 15 '22 09:11

Patrick Hofman