title: Displaying data in datagridview C#
body: <p>I have a problem I would like to display the data in a <code>DataGridView</code>. The script gets the deal with all the txt files and searches using regular expression data in each file. Everything works nicely.</p>
  
  <p>My problem is that I just do not know how to display the results now in <code>DataGridView</code>; </p>
  
  <p>(As if anyone could help me how I do it. Thank you in advance for your help.</p>
  
  <pre class="lang-c# prettyprint-override"><code>private void button2_Click(object sender, EventArgs e)
  {
      string newPath = (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\faktury\\");
      string[] filePaths = Directory.GetFiles(newPath, "*.txt");
  
      foreach (string fp in filePaths)
      {
          string[] lines = File.ReadAllLines(fp);
  
          // Iterate through lines
          foreach (string line in lines)
          {
  
              foreach (Match match in Regex.Matches(line, @"(Numer Faktury:|Numer faktury korygującej: )(.*?)$", RegexOptions.IgnoreCase))
              {
  
                  MessageBox.Show(match.Groups[2].Value);
  
              }
              foreach (Match match in Regex.Matches(line, @"Data wystawienia: (.*?)$", RegexOptions.IgnoreCase))
              {
  
                  MessageBox.Show(match.Groups[1].Value);
  
              }
              foreach (Match match in Regex.Matches(line, @"Wartość netto  (.*?) PLN", RegexOptions.IgnoreCase))
              {
  
                  MessageBox.Show(match.Groups[1].Value);
  
              }
              foreach (Match match in Regex.Matches(line, @"Wartość całkowita VAT 8 %  (.*?) PLN", RegexOptions.IgnoreCase))
              {
  
                  MessageBox.Show(match.Groups[1].Value);
  
              }
              foreach (Match match in Regex.Matches(line, @"Wartość brutto  (.*?) PLN", RegexOptions.IgnoreCase))
              {
  
                  MessageBox.Show(match.Groups[1].Value);
  
              }
          }
  </code></pre>