open/save filedialog woes

  • Thread starter Thread starter Pat Richey
  • Start date Start date
P

Pat Richey

i'm trying to make an open and a save file dialog that allows you to open/save
various formats, but when you change the extension you want to filter the file
list disappears [1] until you leave the current directory. here's the code
for the save box:

SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Portable Document Format (*.pdf)|*.pdf"
+ "|Encapsulated Postscript (*.eps)|*.eps"
+ "|Bitmap (*.bmp)|*.bmp"
+ "|JPEG (*.jpeg;*.jpg)|*.jpeg;*.jpg"
+ "|GIF (*.gif)|*.gif"
+ "|PNG (*.png)|*.png";

if(sfd.ShowDialog() == DialogResult.OK)
{
// do stuff
}

the open dialog is very similar. anyone know what's going on?

thanks,
pat


[1] - here is an example (the current directory contains 2 files, test1.pdf
and test2.eps).

(Filter = *.pdf), dialog shows test1.pdf
(change filter to *.eps), dialog shows no files
(go up a directory and come back), dialog shows test2.eps
(change filter to *.pdf), dialog shows no files
(go up a directory and come back), dialog shows test1.pdf
 
Pat,

I tried your code. It works fine. Can you give a sample with the case and
mail it to (e-mail address removed)? I will investigate that.
 
Pat said:
i'm trying to make an open and a save file dialog that allows you to
open/save various formats, but when you change the extension you want to
filter the file list disappears until you leave the current
directory. here's the code for the save box:

figured it out - somehow the [STAThread] tag got removed from Main() -
replacing it fixed this problem (and several others).
 
Back
Top