See Also Example
Applies To
File list box.
Description
Occurs when the file listing pattern (such as "*.*") has changed by setting the FileName
Syntax
Sub ctlname_PatternChange (Index As Integer)
Remarks
The argument Index uniquely identifies a control if it is in a control array You can use a PatternChange procedure to respond to pattern changes in a file list box. When you assign a string containing a new pattern to the FileName property, the file list box invokes the PathChange event.
Help:
FileName Property
Path Property
PathChange Event
Pattern Property
Programmer's Guide:
Chapter 18, "Using the File-System Controls"
The example updates a file list box with files matching the pattern typed into a text box. If a full path is entered into the text box, such as c:\bin\*.exe, the text is automatically parsed into path and pattern components. To try this example, paste the code into the Declarations section of a form that contains a text box, a label, a file list 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.
Command1.Caption = "OK" ' Set Caption.
Command1.Default = True ' Set Default.
End Sub
Sub Command1_Click () ' OK button clicked.
' Text is parsed into path and pattern components.
File1.FileName = Text1.Text
Label1.Caption = "Path: " & File1.Path
End Sub
Sub File1_PatternChange ()
Text1.Text = File1.Pattern ' Set text to new pattern.
End Sub