Click here to Skip to main content
14,733,599 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 2: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:-
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..
   
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!!
JayantaChatterjee 1-Sep-16 1:53am
   
check out this link:-
https://support.microsoft.com/en-in/kb/306666
Le Van Phu 4-Sep-16 23:30pm
   
this is search to file name, i want search in contains file at all sub-folder.
help me. please
help me.
i want search AllDirectories. but i dont know how to do.
For Each Dir As String In Directory.GetDirectories(path)
but not word
   

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