Function help needed...

I known that what I want to do is possible... i just dont know the
commands.

Here's what I want to do:
-------------------------------
Find all files on the users computer

Open every file and search for a text string...
-------------------------------

Please help.



Answer this question

Function help needed...

  • Joaquin Raya

    Thanks alot!

    But I still wonder if there is a way to get a string of the file that is currently being
    checked, because it might take much time to check and I can't let the user just wait
    and think that the program crashed.

    Regards,
              Oliver

  • Helloimbob

    Thanks alot!

    But I still wonder if there is a way to get a string of the file that is
    currently being checked.

    Regards,
         Oliver

  • Peter Huang --- MSFT

    Try this:
    Dim files As ReadOnlyCollection(Of String)
    files =
    My.Computer.FileSystem.FindInFiles("C:\", "Text To Search For", True, FileIO.SearchOption.SearchAllSubDirectories, "*.txt")

    You can also find useful snippets of code if you right click in the editor and choose:
    Insert Snippet--->File system -Processing Drives, Foders, and Files

    Luca Dellamore

    Visual Basic Test Team


  • boon3333

    Thanks alot!

    But I still wonder if there is a way to get a string of the file that is currently being
    checked, because it might take much time to check and I can't let the user just wait
    and think that the program crashed.

    Regards,
              Oliver

  • scott13

    To follow up what ParamArray is; it allows you to create functions that take an arbitrary number of parameters. See http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbls7/html/vblrfvbspec7_1_6_4.asp for a detailed description.

    The reason that the compiler complains in this case is that you are using it when *calling* the function. The compiler only expects to see this where you define your function.

    Public Sub MyFunction(ParamArray paramters() as String)
    End Sub

    can be called like:

    MyFunction()
    MyFunction("Zpp")
    MyFunction("Foo", "Bar")

    or even

    MyFunction("Foo", "Bar", "Doo", "Daa", "Tjo", "Knatte", "Fnatte", "Tjatte")

    but not like

    MyFunction(ParamArray "Foo", "Bar")

    Best regards,
    Johan Stenberg



  • crc32

    hi,

    i asked the same question but about something else and i got an answer for that

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=189577&SiteID=1

    hope it helps



  • sulphox

    Ok, i found some code , but i dont understand what the 'paramArray' is.
    It keeps giving error.



    Dim
    filePaths As StringfilePaths = My.Computer.FileSystem.GetFiles("C:\",FileIO.SearchOption.SearchAllSubDirectories, ParamArray wildcards("*.*")As String)
    MessageBox.Show(filePaths)

     


  • Function help needed...