Trouble setting properties in saveFileDialog

M

moondaddy

I have a winform app using vb.net and I dragged a saveFileDialog control
onto the form. In the code below I'm trying to set some properties for some
default setting for when it opens up. Even though I set the initial
directory to "d:\" and default extension to ".gif" (I also tried "gif") it
still opens to the directory it was last opened to and defaults to jpeg as a
file type instead of gif. How can I get control of these default values
when it opens up?


saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif
Image|*.gif"
saveFileDialog1.Title = "Save an Image File"
saveFileDialog1.ShowDialog()
saveFileDialog1.InitialDirectory = "d:\"
saveFileDialog1.FilterIndex = 3
saveFileDialog1.DefaultExt = ".gif"
 
H

Herfried K. Wagner [MVP]

* "moondaddy said:
I have a winform app using vb.net and I dragged a saveFileDialog control
onto the form. In the code below I'm trying to set some properties for some
default setting for when it opens up. Even though I set the initial
directory to "d:\" and default extension to ".gif" (I also tried "gif") it
still opens to the directory it was last opened to and defaults to jpeg as a
file type instead of gif. How can I get control of these default values
when it opens up?


saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif
Image|*.gif"
saveFileDialog1.Title = "Save an Image File"
saveFileDialog1.ShowDialog()

Remove the line above and put it after the last line of the following
code:
 

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