• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 855
  • Last Modified:

VB.NET File Search

I am trying to create a function in my application that will search for key words either in the file name or within the file like windows xp does. I have found a few links that will search the file name but am looking for guidance for searching within the document. Should i just open the file and read contents and look for my key words like that or is there an easy way?
0
jimseiwert
Asked:
jimseiwert
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
Yes, you would need to open each (text) file in order to search for keywords--that is unless you are planning to make your own indexing application to speed up searches (the way XP does).
0
 
djon2003Commented:
This class built by someone could help you out.. You would just have to add to open each file found to search within it.

http://www.vbforums.com/showthread.php?t=341919
0
 
ThickmanCommented:
How about using:

My.Computer.FileSystem.FindInFiles("c:\directory", "text", True, SearchOption.SearchAllSubDirectories, "*wildcard")

where:

item 1 = the directory to search
item 2 = the text to find in the file or filename
item 3 = obvious
item4 = wildcards
0
 
ThickmanCommented:
My fault:

item 3 = boolean (ignore case)
item 4 = search type
item 5 = wildcards
0
 
käµfm³d 👽Commented:
I stand corrected. I wonder how it performs...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now