Filtering on two or more file extensions in a File Dialog Box

Posted on 2006-05-23
Last Modified: 2010-04-16
Hi there,

I have a file dialog box and right now I can filter these 3 extensions ( "All File Types. "Txt Files" and "Jpg files"  ) with the Following:

FileInfo fileinfo = getFileName("All files (*.*)|*.*|Gif files (*.GIF)|*.GIF|Jpeg files (*.jpg)|*.jpg");

How can I combine the Gif and jpeg filters into one so that the user can see all gifs and jpegs together in the directory listing and nothing else?
Question by:phunchak
    1 Comment
    LVL 11

    Accepted Solution

    Just group them together, like so:

               OpenFileDialog fdlg = new OpenFileDialog();
                fdlg.Filter = "(*.JPG;*.GIF)|*.JPG;*.GIF";


    Featured Post

    Live - One-on-One C# Help from Top Experts

    Solve your toughest problems, fast.
    C# experts are online now and ready to help you.

    Join & Write a Comment

    Suggested Solutions

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now