First I read the TextBox1 using TextReader than tried to find a string 'flag' in TextBox1
TextReader read = new System.IO.StringReader(TextBox1.Text);
int rows = 5000;
string[] text1 = new string[rows];
for (int r = 1; r < rows; r++)
{
text1[r] = read.ReadLine();
}
string flag = "healthy";
string[] readText = text1;
foreach (string s in readText)
{
if ((s.Contains(flag) == true))
{
TextBox2.Text = s.ToString();
break;
}
else
{
TextBox2.Text = "Not Found";
}
}
than I got this error []
I want the program to find a keyword in a TextBox lines if the program finds it write the keyword with the whole line into another textbox TextBox2.