HI, all, I want to ask a question as what I described in the topic.
For example, now I have some data in the text box, such like :

$VTG,,,,,,,,,N*30
$GGA,,,,,,0,00,99.99,,,,,,*48
$GSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GSV,1,1,00*79
$GLL,,,,,,V,N*64
$ZDA,,,,,00,00*48
$GSV,,,,,,,,,,00*67
.
.
.
.
.

From all these data, what I want is only the string starts with $GSV, so how can I pick this kind of string out and put them into another textbox?Should I save all these data first and use the StreamReader to read each line of the saved file?

Thank you for your kind helping~!

First take your textbox's text in string apply your regular expression pattern to extract your interseting part in that string.

using (StreamReader sr = new StreamReader("TestFile.txt")) 
{
   string line;
   while ((line = sr.ReadLine()) != null) 
    {
        if (line.Substring(0,4) == "$GSV")
        {
            Textbox1.Test = line.
        }
     }
}

using (StreamReader sr = new StreamReader("TestFile.txt"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Substring(0,4) == "$GSV")
{
Textbox1.Test = line.
}
}
}

I Know this is an old post, and I'm sure the problem has been handled, but actually a better way would not be so save it to a file and then re open it with streamReader, the original question said they started with the text in a text box, so best would be a stringreader

using (StringReader sr = new StringReader(Textbox1.Text))
   { string line;
      while((line =sr.ReadLine())!= null)
        {if (line.Substring(0,4) == "$GSV")
          {
              Textbox2.Text = line;
          }
         }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.