共用方式為


DocumentList.Filter Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets a file filtering specification.

Namespace:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

Syntax

'Declaration
Public Property Filter As String
    Get
    Set
'Usage
Dim instance As DocumentList
Dim value As String

value = instance.Filter

instance.Filter = value
public string Filter { get; set; }
public:
property String^ Filter {
    String^ get ();
    void set (String^ value);
}
member Filter : string with get, set

Property Value

Type: System.String
The currently specified file filters.

Exceptions

Exception Condition
ArgumentException

The filtering specification is invalid.

Remarks

For each filtering option, the filter string contains a description of the filter, followed by a vertical bar (|) and the filter pattern. Because of limited space, Pocket PC guidelines suggest skipping the description. An omitted description requires a space before a vertical bar.

For example, the following filter string includes a description:

"Text files (*.txt)|*.txt"

Without a description, this filter string should appear as:

" |*.txt"

A vertical bar also separates filtering options. You can use semicolons to delineate multiple filter patterns within a filter option. The following filter string specifies five filtering options:

" |*.*| |*.pwi;*.pdt| |*.rtf| |*.txt| |*.xml"

Use the FilterIndex property to specify which filtering option the user is shown first. The FilterIndex is zero-based. Using the filter string just described, the index values are as follows:

Index value

Filter pattern

0

*.*

1

*.pwi;*.pdt

2

*.rtf

3

*.txt

4

*.xml

Examples

The following code example sets the Filter property. This code example is part of a larger example provided for the DocumentList class.

.Filter = " |*.*| |*.txt;*.xml| |*.pwi;*.pdt| |*.pxl;*.psw| |*.jpg;*.gif;*.bmp| |*.wav;*.wmv;*.mpg;"
DocList.Filter = " |*.*| |*.txt;*.xml| |*.pwi;*.pdt| " +
   "|*.pxl;*.psw| |*.jpg;*.gif;*.bmp| |*.wav;*.wmv;*.mpg;";

.NET Framework Security

Platforms

Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

DocumentList Class

DocumentList Members

Microsoft.WindowsCE.Forms Namespace