2

I am trying to add a filter OpenFileDialog control but after using filter. There is no file just folders . Without filter everything is ok. What can i do?

 private void button1_Click(object sender, EventArgs e) { OpenFileDialog fileChooser = new OpenFileDialog(); fileChooser.Filter = " Image File (*.jpeg)|(*.jpeg)| All Files (*.*) |(*.*)"; if (fileChooser.ShowDialog() == DialogResult.OK) { pictureBox1.ImageLocation = fileChooser.FileName; } } 
2

1 Answer 1

7

just don't use brackets when defining the file-extension.

fileChooser.Filter = "Image File (*.jpg)|*.jpg;*.jpeg|All Files|*.*"; 
Sign up to request clarification or add additional context in comments.

1 Comment

there's no other error in your code. Are you sure you want to use jpeg as extension and not jpg? Because last one is more common and I don't know what could be wrong otherwise.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.