By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,422 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,422 IT Pros & Developers. It's quick & easy.

open/save filedialog woes

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.