Type | Description | |||
String | A string expression that indicates the list of files or folders to search for. |
Use the Search property to get the list of files and folders that match a pattern or multiple patterns. The Search property includes the patterns separated them by space character. A pattern may include wild characters like : '*' (Zero or more characters) or '?' ( Any single character ). For instance, the '*.txt *.doc' specifies all files with extension 'txt' and files with 'doc' extension. Use the Add method to add rules to customize the found items. Use the StopSearch method to stop immediately searching the files. The Search event is fired when searching files starts or when searching the files ends. The Search = "" stops searching files and restores the control's content to browse the ExploreFromHere path. Use the Get method to get the list of files and folders in the control.
The following VB sample gets the list of document files and text files:
Private Sub Command1_Click() ExFileView1.Search = "*.doc *.txt" End Sub Private Sub ExFileView1_Search(ByVal State As EXFILEVIEWLibCtl.SearchStateEnum) Select Case State Case 0 Debug.Print "Searching for '" & ExFileView1.Search & "' starts." Case 1 Debug.Print "Searching for '" & ExFileView1.Search & "' ends." End Select End Sub
The following VB sample searches for the '.cpp' files and get them in red color, and '.h' files and get them in blue color:
Private Sub Command1_Click() With ExFileView1 With .FileTypes With .Add("*.cpp") .ForeColor = vbRed End With With .Add("*.h") .ForeColor = vbBlue End With End With .Search = "*.cpp *.h" End With End Sub Private Sub ExFileView1_Search(ByVal State As EXFILEVIEWLibCtl.SearchStateEnum) Select Case State Case 0 Debug.Print "Searching for '" & ExFileView1.Search & "' starts." Case 1 Debug.Print "Searching for '" & ExFileView1.Search & "' ends." End Select End Sub