See Also Example
File list box.
Determines which file names are displayed in a file list box at run time.
[form.]filelistbox.Pattern[ = display ]
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.
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 Drive , FileName , and Path .
Changing the value of Pattern generates a PatternChange event.
Archive, Hidden, Normal, System PropertiesVNIBPL
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.
Sub Command1_Click ()
' Text is parsed into path and pattern components.
File1.Filename = Text1.Text
Dir1.Path = File1.Path ' Set directory path.
Sub File1_PatternChange ()
Text1.Text = File1.Pattern ' Set text to new pattern.
File1.Path = Dir1.Path ' Set file list box path.