Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SaveFileDialog displaying only file with specific extension

I want to save an image which has two options (.Png or .Jpeg),so i need to display only files with Png and Jpeg format, like when we choose Save type as All Images it displays all kind of images in the dialog. so how would i do that?

using(SaveFileDialog saveFileDialog1 = new SaveFileDialog())
{
     saveFileDialog1.InitialDirectory = Convert.ToString(Environment.SpecialFolder.MyPictures);
     saveFileDialog1.Filter = "Images (*.Png + Jpeg)|*.Png + *.Jpeg";
}
like image 247
Murhaf Sousli Avatar asked May 16 '12 02:05

Murhaf Sousli


1 Answers

You'd be looking for a filter like this:

"Images (*.png,*.jpeg)|*.png;*.jpeg";

or optionally:

"Images (*.png,*.jpeg)|*.png;*.jpeg|All files (*.*)|*.*"
like image 55
spender Avatar answered Sep 23 '22 14:09

spender