PatternChange Event Example

This example updates a FileListBox control with files matching the pattern entered in a TextBox control. If a full path is entered into the TextBox, 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 TextBox control, a Label control, a FileListBox control, and a CommandButton control, and then press F5 and enter a valid file pattern in the TextBox.

Private Sub Form_Load ()
   Command1.Default = True         ' Set Default property.
   Command1.Caption = "OK"         ' Set Caption.
End Sub

Private 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

Private Sub File1_PatternChange ()
   Text1.Text = File1.Pattern   ' Set text to new pattern.
End Sub