PatternChange Event

See Also4K9H0FT              ExampleKOH1HC>Low

Applies To

File list box1M6S8UX.

Description

Occurs when the file listing pattern (such as "*.*") has changed by setting the FileNameJHVBZJ or PatternXYKZRG properties from code.

Syntax

Sub ctlname_PatternChange (Index As Integer)

Remarks

The argument Index uniquely identifies a control if it is in a control array8G7Y0UU.  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 PathChange3811T7 event.


See Also

Help:

FileName PropertyJHVBZJ

Path PropertyBKGP79

PathChange Event3811T7

Pattern PropertyXYKZRG

 

Programmer's Guide:

Chapter 18, "Using the File-System Controls"


PatternChange Event Example

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