I wrote a function for searching in a text file and if favorit string exist, report me, but it don't work properly,
private void searchinfile(string fileadd,string text)
{
StreamReader s = new StreamReader(fileadd);
string currentLine;
string searchString = text;
bool foundText = false;
do
{
currentLine = s.ReadLine();
if (currentLine != null)
{
foundText = currentLine.Contains(searchString);
}
}
while (currentLine != null && !foundText);
if (foundText)
{
MessageBox.Show("the word is repeated, do you want to save it?");
}
}
what is wrong?
best regards
This post has been edited by hamidkhl: 04 September 2009 - 04:23 AM

New Topic/Question
Reply



MultiQuote





|