Filter Property (Common Dialog)

Applies To

Common dialog1H1HYJI (file dialog).


Specifies the filters that are displayed in the dialog box's Type list box.


[form.]CMDialog.Filter[ = description1 |filter1 |description2 |filter2 ...]


A filter specifies the type of files that are displayed in the dialog box's file list box.  For example, selecting the filter *.TXT displays all text files.

Use this property to provide the user with a list of filters that can be selected when the dialog box is displayed.

Use the pipe ( | ) symbol (ASCII 124) to separate the description and filter arguments.  Don't include spaces before or after the pipe symbol, because these spaces will then appear with the description and filter values.

The following code shows an example of a filter that allows the user to choose text files or picture files that include bitmaps and icons:

Text (*.txt)|*.txt|Pictures(*.bmp;*.ico)|*.bmp;*.ico


When you specify more than one filter for a dialog box, use the FilterIndexE0CVU1 property to determine which filter is displayed as the default.

Data Type