Filter Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Specifies the file masks used by the dialog.

Declaration

componentObj.Filter
Read-Write Property String
componentObj     One of the user forms components listed in the Applies To section  

Applies To

The property applies to the following components:

TOpenDialog, TSaveDialog

Description

The dialog has a drop-down list where the user can select one of the available file types to be shown. By default this list of file filters is empty and all files are displayed in the dialog. Use the Filter property to populate a list of available file filters and make the dialog only show the files of the selected type(s).

To specify a file filter for this property, assign a string that consists of a filter description and a file mask separated with the vertical bar (|) character. Do not include spaces around the vertical bar. For example:

OpenDialog1.Filter = "Text files (*.txt)|*.TXT";

To specify several file filters separate their descriptions and masks with the vertical bar (|). For example:

OpenDialog1.Filter = "All files (*.*)|*.*|Text files only (*.txt)|*.TXT";

To add several file masks to a filter separate them with the semicolons:

OpenDialog1.Filter = "Hypertext files only (*.htm, *.html)|*.HTM;*.HTML";

If the dialog has several filters, you can determine or set the active filter via the FilterIndex property.

Property Value

A string value that is used as the file mask(s) by the dialog.

See Also

FilterIndex Property

Highlight search results