CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    13

    Open File Dialog Filter question

    Alright.

    I am trying to filter the open file dialog file types to only include images, as this open file dialog is for selecting images. I have a question, and am not sure it is possible. I cannot find a clear answer on the internet. Right now, I am filtering for image files like so:

    openFilePic.Filter = "Graphics Interchange Format Files (.gif) | *.gif|" +
    "JPEG File Interchange Format (.jpeg) | *.jpeg|" +
    "JPG File Interchange Format (.jpg) | *.jpg|" +
    "MS Windows Bitmap Files (.bmp) | *.bmp|" +
    "Portable Networks Graphics (.png) | *.png|" +
    "Tagged Image File Format (.tiff) | *.tiff|" +
    "Windows Enhanced Metafile (.emf) | *.emp|" +
    "Windows Metafile (.wmf) | *.wmp";

    This doesn't really stoke me out... I don't like it, but it DOES work. (I can't really trust the user to know what they are doing, which is why I can't use "show all files|*.*")

    My question:

    Is there any way to combine these file types, to do something like "Show all Image Files"?

    I have tried combining the file types by using + signs, commas, breaking the quotes and using '&'...nothing seems to work. I can't seem to find the solution online here.

    Was wondering if any of you knew whether it was possible or not? Thanks!

    Using .Net 9.0
    Last edited by kpizzle; October 21st, 2008 at 10:42 AM.

  2. #2
    Join Date
    Sep 2008
    Posts
    13

    Re: Open File Dialog Filter question

    OK!

    Found the solution.

    Who would've thought a semi-colon was the answer?

    Here's what worked:

    openFilePic.Filter = "All Image Files|*.gif; *.jpeg; *.jpg; *.bmp; *.png; *.tiff; *.emp; *.wmp";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured