How to search

I am using VB 2003, and am wondering how you make it perform a search. Like say I want to make a program to search for explorer.exe how would I do this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You mean search for a particular File in the System ???

You need to recursively search all the Drives/Folders/Sub-Folders
Or if you want access to some system files like explorer.exe which you know are in a particular path you can directly access

here's a code for recursive searching

   Public Sub ProcessDirectory(ByVal targetDirectory As String)
        Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
        Dim fileName As String
        For Each fileName In fileEntries
            If fileName.ToUpper = "EXPLORER.EXE" Then
                Exit Sub
            End If
        Next fileName
        Dim subdirectoryEntries As String() = Directory.GetDirectories(targetDirectory)
        Dim subdirectory As String
        For Each subdirectory In subdirectoryEntries
        Next subdirectory
    End Sub

call it like ProcessDirectory("C:\")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tenchi86Author Commented:
Thanks I will try this later it seems to be what I needed though. Also yes pretty much I just wanted to make vb go into say my computer/C:/programs and find what file I tell it to find.
tenchi86Author Commented:
Sorry, for asking this but im a complete noob to this. When I try and run this it pretty much says cannot run debug file not found. So I am screwing up some wheres just not sure where. Also say I wanted it to find say just the winamp file and not winamp.exe do I just replace winamp.exe with winamp?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.