Use file filters in an open file dialog or save file dialog in C#
The OpenFileDialog and SaveFileDialog components have a Filter property that lets the user look for specific kinds of files. The property's value should be a pipe symbol (|) separated list of alternating filter names and patterns. Each pattern can include more than one file matching pattern separated by semi-colons.
This example uses the following Filter:
Bitmaps|*.bmp|PNG files|*.png|JPEG files|*.jpg|Picture files|*.bmp;*.jpg;*.gif;*.png;*.tif|The parts of the filter are:
CS files|*.cs|Project files|*.csproj|Program files|*.cs;*.csproj;*.sln;*.suo;*.resx
- Bitmaps - *.bmp
- PNG files - *.png
- JPEG files - *.jpg
- Picture files - *.bmp;*.jpg;*.gif;*.png;*.tif
- CS files - *.cs
- Project files - *.csproj
- Program files - *.cs;*.csproj;*.sln;*.suo;*.resx
-



Comments