OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Image files (*.jpeg, *.jpg, *.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*";This example sets the filter to only allow selection of image files with the extensions .jpeg, .jpg, and .png, or all files.