1
votes

How to set multiple extension in Open File Dialog. For example i want to load an image file. So, OpenFileDialog should filter all image file.

dlg.Filter = "Image File|*.jpg";

But, It should be displayed all image files. ie. jpeg, bmp, tif, gif, png, etc. How do i do this.

2

2 Answers

3
votes

Like this:

dlg.Filter = "JPG|*.jpg|PNG|*.png|BMP|*.bmp";

If you want to combine all extensions use semicolon between extensions like this:

dlg.Filter = "Image Files|*.jpg;*.bmp;*.png";

Here is the documentation for reference: OpenFileDialog.Filter Property

0
votes

dlg.Filter = "Image File|.jpg,.png|JPEG Files|.jpg|PNG Files|.png";