Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a program where the user can change the background image of the form. Right now I just have about 5 images they can choose and when they choose a new image it saves to a file so that when they open the program again it will load the right image for the background. I want to add a custom option so they can choose a image file but I can't figure out how to get the file path and file name from the dialog box.
Posted
What dialog box? The FileOpenDialog? Your own?

 

If you are using the FileOpenDialog then you just read the FileName property.

 

I'm using the FileOpenDialog. So the FileName property will get the the name of the file but what will get me the path for it?

Posted

ok, i got it all to work the way I wanted. now im trying to get the dialog box to filter but its now working, so far I have and it works fine:

 

dialogCustomTheme.Filter = "Image Files (*.jpg)|*.jpg"

 

But I want to have more than just jpg so I tried things like but it doesnt work:

 

dialogCustomTheme.Filter = "Image Files (*.jpg)|*.jpg, *.bmp, *.png"

  • *Experts*
Posted

This example is straight from the MSDN documentation. All you have to do is in your second part of the filter separate them using the semicolon instead of a comma.

Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...