title: search text file for specific value and extract the next number of lines
body: <p>i have scrawled through countless similar searches but i am having trouble finding out how to extract lines out of a text file after i searched using a specific word. what i am trying to do is below along with my textfile and code, thanks for any help. i can display the transaction number but im not sure how to add the rest of the relevant information.</p>
  
  <p><strong>My Aim</strong>
  User story: The customer provides a transaction number to an employee. The employee looks up the transaction number in the system, and can see the transaction details. The customer enquires about these details, as (s)he may have forgotten when the investment matures. </p>
  
  <p><strong>What my text file looks like</strong>
  Transaction number : 100002
  Investor : Mr Daryn Tully
  Transaction Date : 01 March 2017
  Deposit amount : €100000
  Amount of interest : €19.18 Interest after one week
  Rate of interest : 1%
  Period of investment : 6 week</p>
  
  <p>Transaction number : 100002
  Investor : Mr GHSHSH GGSGS
  Transaction Date : 01 March 2017
  Deposit amount : €1000000
  Amount of interest : €191.78 Interest after one week
  Rate of interest : 5%
  Period of investment : 1 week</p>
  
  <p>Transaction number : 100003
  Investor : 111 111 1111
  Transaction Date : 01 March 2017
  Deposit amount : €11111111
  Amount of interest : €2,130.90 Interest after one week
  Rate of interest : 1%
  Period of investment : 1 week</p>
  
  <p><strong>My code</strong></p>
  
  <pre><code>  private void SearchButton_Click(object sender, EventArgs e)
          {
              try
              {
                  string Line;
                  string TransactionHistory;
  
                  string SearchKeyword = "Transaction number ";
  
                  StreamReader InputFile;
  
                  InputFile = File.OpenText("TransactionHistory.txt");
  
                  while (!InputFile.EndOfStream)
                  {
                      String[] lineElements = new String[2];
                      Line = InputFile.ReadLine();
                      lineElements = Line.Split(':');
  
                      if (Line.Contains(SearchKeyword))
                      {
                          TransactionHistory = (lineElements[1].TrimStart());
  
                          if (TransactionHistory.Equals(TransactionNumberTextBox.Text))
                          {
                              SummaryListBox.Items.Add(Line);
                          }
                          else
                          {
                              MessageBox.Show("No matches found");
                              TransactionNumberTextBox.SelectAll();
                              TransactionNumberTextBox.Focus();
                              break;
                          }
                      }
                  }
  
              InputFile.Close();
          }
  
          catch
          {
              MessageBox.Show("Transaction number not found");
              TransactionNumberTextBox.SelectAll();
              TransactionNumberTextBox.Focus();
          }
  </code></pre>