Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search File Contents for String

Status
Not open for further replies.

RJL1

Technical User
Oct 3, 2002
228
0
0
US
Hello,

I have a small application which is a work in progress. My next step in this applications is to allow the end user to search files in a directory for a file containing a specific string.

The application has a text box where the end user enters an order number. I want to search a folder c:\Orders fro a file that contains this order number (there will only be one file per order). The files are XML files. I need to search all XML files and when it finds the file containing the order number return the file name so I can use it in a string to open the file.

Being new to C# I am not sure how to accomplish this and open to suggestions on the best way to accomplish this. Since I am not sure how to proceed with this I do not have any code to share

Thanks in advanced for any help

RJL
 
Hi RJL,

Microsoft has a Search SDK which allows you to use the Desktop Search in C#:

Another, ready solution you might find handy is this "File Searcher in C#" on codeproject.com:

Good luck!

MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top