System.IO.StreamReader sr = new System.IO.StreamReader(@"d:\balamurali\bb.doc");string content = sr.ReadLine();int lineno = 1;while (content != null){ if (content.IndexOf("SomeText") > 0) MessageBox.Show("The specified text found in line no: " + lineno.ToString()); lineno++; content = sr.ReadLine();}