开发者

SaveFileDialog Extensions Overlapping

I would like to offer multiple extensions in my SaveFileDialog. I would like to have the following extensions:

Please see my posted answer for the solution. It was a quick fix - and a fairly dumb mistake.

SFD.Filter = "EXE (*.exe) |*.exe |JPEG (*.jpg)|*.jpg | MP3 (*.mp3)|*.mp3 | WAV (*.wav) |*.wav ";

Using the above filter, when the file type is changed, the extension is appended to the filename. I would prefer that the file extensions replace one another.

An example of what the dialog filename migh开发者_开发知识库t look like after switching file types:

OutputFile.exe .jpg .mp3 .wav

Thank you for any help,

Evan


If you want to combine all extensions to one selection filter, try

SFD.Filter = "EXE (*.exe), JPEG (*.jpg), MP3 (*.mp3), WAV (*.wav)|*.exe;*.jpg;*.mp3;*.wav";

For reference, check out the remarks section of the MSDN page for FileDialog.Filter


The issue with my original code is that I had spaces between the " | " marks. Please see my answer below for a comparison.

SFD.Filter = "EXE (*.exe)|*.exe|JPEG (*.jpg)|*.jpg|MP3 (*.mp3)|*.mp3|WAV (*.wav)|*.wav ";

Notice how there are no spaces.

Thank you, Evan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜