문제

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;
       }
  }
도움이 되었습니까?

해결책

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

fileChooser.Filter = "Image File (*.jpg)|*.jpg;*.jpeg|All Files|*.*";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top