Winform file filter and winform file Filter

Source: Internet
Author: User

Winform file filter and winform file Filter

In the. net Framework, Microsoft encapsulates an OpenFileDialog dialog box for opening files. This dialog box contains a Filter attribute that can Filter files. This attribute can be used to Filter the files we need.

Therefore, it is necessary to remember the format of the Filter attribute. There are two types of formats:

1 // a filtering item contains multiple formats 2 ofd. filter = "image file (*. gif ;*. png ;*. jpg ;*. bmp ;*. ico) | *. gif ;*. png ;*. jpg ;*. bmp ;*. ico "; 3 // multiple filtering Items 4 ofd. filter = "pdf file (*. pdf) | *. pdf | text file (*. txt) | *. txt ";

Example: If the Filter attribute is set as follows:

1 ofd. filter = "all files (*. *) | *. * "+" | "+ 2" text file (*. txt) | *. txt "+" | "+ 3" pdf file (*. pdf) | *. pdf "+" | "+ 4" office files (*. doc ;*. docx ;*. xls ;*. xlsx ;*. ppt ;*. pptx) | *. doc ;*. docx ;*. xls ;*. xlsx ;*. ppt ;*. pptx "+" | "+ 5" image file (*. gif ;*. png ;*. jpg ;*. jpeg ;*. bmp ;*. ico) | *. gif ;*. png ;*. jpg ;*. jpeg ;*. bmp ;*. ico "+" | "+ 6" audio file (*. mp3 ;*. mid ;*. wav;) | *. mp3 ;*. mid ;*. wav; "+" | "+ 7" video file (*. mp4 ;*. avi ;*. rmvb ;*. wmv ;*. mkv ;*. flv) | *. mp4 ;*. avi ;*. rmvb ;*. wmv ;*. mkv ;*. flv "+" | "+ 8" compressed file (*. rar ;*. zip ;*. 7z) | *. rar ;*. zip ;*. 7z "+" | "+ 9" HTML file (*. htm ;*. html) | *. htm ;*. html "+" | "+ 10" XML file (*. xml ;*. xaml) | *. xml ;*. xaml "+" | "+ 11" code file (*. c ;*. cpp ;*. h ;*. hpp ;*. cs ;*. java) | *. c ;*. cpp ;*. h ;*. hpp ;*. cs ;*. java "+" | "+ 12" program file (*. exe ;*. dll ;*. jar ;*. class) | *. exe ;*. dll ;*. jar ;*. class ";

Article synchronous update: http://www.motyer.cn/Files/BlogDetails/winform-file-filter.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.