Pattern Property

See Also6MN40C8                 Example18TN3UX>Low

Applies To

File list box1M6S8UX.

Description

Determines which file names are displayed in a file list box at run time.

Usage

[form.]filelistbox.Pattern[ = display ]

Setting

The value of the Pattern property is a string indicating a file specification, such as "*.*" or "*.FRM".  The default is "*.*", which returns a list of all files.  In addition to using wildcard characters, you can also use multiple patterns separated by semicolons.  For example, "*.EXE; *.BAT" would return a list of all executable files and all MS-DOS batch files.

Remarks

The Pattern property plays a key role in designing an application's file-browsing and manipulation capabilities.  Use Pattern in combination with other file-control properties to provide the user with ways to explore files or groups of similar files.  For example, in an application dedicated to launching other programs, you might designate that only .EXE files be displayed in the file list box (*.EXE).  Other key file-control properties include DriveYLV8AS, FileNameJHVBZJ, and PathBKGP79.

Changing the value of Pattern generates a PatternChange2JU7UW9 event.

Data Type

String7WSH0XQ


See Also

Help:

Archive, Hidden, Normal, System PropertiesVNIBPL

Path PropertyBKGP79

PathChange Event3811T7

PatternChange Event2JU7UW9

ReadOnly Property2JZQLX0

 

Programmer's Guide:

Chapter 18, "Using the File-System Controls"

Chapter 19, "Processing Files"


Pattern Property Example

The example updates a text box with the new pattern selected in a file list box.  The controls are set up so that when the user enters a pattern in the text box, such as *.TXT, it is reflected in the file list box, much like the interaction you see in a typical File Open dialog box in an application for Microsoft Windows.  If a full path such as C:\BIN\*.EXE is entered into the text box, the text is automatically parsed into path and pattern components by the file list box.  To try this example, paste the code into the Declarations section of a form that contains a directory list box, a file list box, a text box, and a command button.  Then press F5 and type a valid file pattern into the text box.

Sub Form_Load ()
  Command1.Default = True          ' Set Default property.
End Sub
Sub Command1_Click ()
  ' Text is parsed into path and pattern components.
  File1.Filename = Text1.Text
  Dir1.Path = File1.Path           ' Set directory path.
End Sub
Sub File1_PatternChange ()
  Text1.Text = File1.Pattern       ' Set text to new pattern.
End Sub
Sub Dir1_Change
  File1.Path = Dir1.Path           ' Set file list box path.
End Sub