Hi,
In addition to previous answer...
I think that is the best solution for a very small
files (e.g. tens of kBytes):
string wholeTextOfFile=streamReader.ReadToEnd();
If you're sure that searched string doesn't
contain a new line characters the i can recoment to
read it line by line, and search each line with
method "IndexOf". In a case of "first occurence",
this should be the best (fastest) solution i think.
Cheers!
Marcin
Hi Liz
You can need to load or you file first into a string then you can use the
index of function to search for any assurance of your string ( the one you
are searching for ) into the file ( that is now loaded in the big string)
Int k = BigString.IndexOf( small string) .
If this gives you positive number then this is where you find you're your
string if -1 then the string you are looking for doesn't exist in the file.
Hope this helps
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC