Show File types in OpenFileDialog in .Net
By Santhosh N
This explains how to show only selected file types in the open file dialog in c# using Filter Property
OpenFileDialog in c# allows to open the files from the physical location accessible
to the c# program from the system
To show all files filter in the
dialog, you can use this
openFileDialog1.Filter = "All files (*.*)|*.*";
To show both gif files and png files, you can use this
openFileDialog1.Filter = "Gif files (*.gif)|*.gif|Png files (*.png)|*.png";
You can have any number of file types associated to this seperated
by | symbol.
You could also set the default type to be selected
by using FilterIndex property
openFileDialog1.FilterIndex = 1;
Show File types in OpenFileDialog in .Net (2566 Views)