Export (0) Print
Expand All
F
Expand Minimize

Visual Basic: CommonDialog Control

Visual Studio 6.0

Filter Property (CommonDialog)

See Also   Example   Applies To

Returns or sets the filters that are displayed in the Type list box of a dialog box.

Syntax

object.Filter [= description1 |filter1 |description2 |filter2...]

The Filter property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
description A string expression describing the type of file.
filter A string expression specifying the filename extension.

Remarks

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 values. Don't include spaces before or after the pipe symbol, because these spaces will be displayed with the description and filter values.

The following code shows an example of a filter that enables the user to select text files or graphic 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 FilterIndex property to determine which filter is displayed as the default.

Data Type

String

Show:
© 2014 Microsoft