title: How to count not-empty rows of each column in one datagridview and show numbers of rows in the second datagridview?
body: <p>I have 2 datagridviews:</p>
  
  <p>1 - Shows data from database.</p>
  
  <p>2 - Has to show number of not-empty rows of each column in the first datagridview.</p>
  
  <p>I tried this code, but it count every row:</p>
  
  <pre><code>     var count = dataGridView1.Rows.Cast&lt;DataGridViewRow&gt;().Where(row =&gt; !(row.Cells[0].Value == null || row.Cells[0].Value == DBNull.Value)).Count();
  </code></pre>
  
  <p>The second datagridview has to show distinct not-empty rows.</p>
  
  <p>Please help to solve this problem.</p>
  
  <p>Thank you for helping.</p>