469,313 Members | 2,652 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,313 developers. It's quick & easy.

open/save filedialog woes

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
Nov 16 '05 #1
2 2458
Pat,

I tried your code. It works fine. Can you give a sample with the case and
mail it to sh***********@yahoo.com? I will investigate that.

--
Shak
(Houston)
"Pat Richey" <ri****@uiuc.edu> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
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

Nov 16 '05 #2
Pat Richey wrote:
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).
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Phil Stanton | last post: by
3 posts views Thread by Ecohouse | last post: by
1 post views Thread by Ecohouse | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.