open/save filedialog woes

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
 
S

Shakir Hussain

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.
 
P

Pat Richey

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top