I need simple code for searching files in text box to enter the name of file and in listbox to show results of searching.
Printable View
I need simple code for searching files in text box to enter the name of file and in listbox to show results of searching.
DirectoryInfo GetFiles
http://msdn.microsoft.com/en-us/libr....getfiles.aspx
But i dont want to take i file i want some file with some name morandi - angels and to show only that. ??Code:Imports System
Imports System.IO
Public Class GetFilesTest
Public Shared Sub Main()
' Make a reference to a directory.
Dim di As New DirectoryInfo("c:\")
' Get a reference to each file in that directory.
Dim fiArr As FileInfo() = di.GetFiles()
' Display the names of the files.
Dim fri As FileInfo
For Each fri In fiArr
Console.WriteLine(fri.Name)
Next fri
End Sub 'Main
End Class 'GetFilesTest
I don't understand you. What is "morandi - angels"?
The name of the song that i want to find in the directorium "morandi - angles.mp3" this is exsample
is this what you mean?
vb Code:
Dim files() As String = IO.Directory.GetFiles("c:\", "morandi - angels.mp3", IO.SearchOption.AllDirectories)
the 2nd parameter can contain wildcard characters (i.e. '*')
Somthing like that is possible without exstension please tell some using of this command.
Dim files() As String = IO.Directory.GetFiles("c:\", "morandi - angels.mp3", IO.SearchOption.AllDirectories)
Dim files() As String = IO.Directory.GetFiles("c:\", "morandi - angels.*", IO.SearchOption.AllDirectories)