Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to i search a string in folder more file text with vb.net
help me.
i code with vb.net but i dont can search help for it.
thank all member

What I have tried:

a string in folder more file text with vb.net
Posted
Updated 31-Aug-16 1:21am
v2
Comments
JayantaChatterjee 31-Aug-16 5:58am    
Your question is not clear to me.
please add your code in the question by clicking on the "Improve Question" link..
Le Van Phu 31-Aug-16 6:07am    
i need code to vb.net scan a string in folder,
ex: i'm need seach "abcd123" in folder. in folder all file text format.
U can help me ?

Try this:-
VB.NET
Imports System.IO
Module Module1

    Sub Main()
        Dim path As String = "D:\New folder"
        Dim di As New DirectoryInfo(path)
        Dim yourSearchString As String
        yourSearchString = "to"
        Console.WriteLine("Match Found:-")
        For Each fi As FileInfo In di.GetFiles()
            If File.ReadAllText(fi.FullName).Contains(yourSearchString) Then
                Console.WriteLine(fi.Name)
            End If
        Next
    End Sub

End Module


I hope this will help you..
 
Share this answer
 
Comments
Le Van Phu 31-Aug-16 6:21am    
Thank you !However i want choose folder in vb. how can do it !!
thank you verry much!
JayantaChatterjee 31-Aug-16 6:23am    
you can use "FolderBrowserDialog" control to choose the folder from the system..
more info click this link:-
https://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog(v=vs.110).aspx
Le Van Phu 31-Aug-16 6:29am    
ok, i understand, oh. if in a path folder have more folder.
ex: New folder/
folder a/
folder b/
folder c/

i want search all sub-folder in a New Folder.
U can help me!? love you
Le Van Phu 31-Aug-16 7:00am    
i want search AllDirectories. but i dont know how to do.
For Each Dir As String In Directory.GetDirectories(path)
but not word
Le Van Phu 31-Aug-16 8:15am    
help me!!
help me.
C#
i want search AllDirectories. but i dont know how to do.
For Each Dir As String In Directory.GetDirectories(path)
but not word
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900