title: C# DataGridView, show columns that only have data
body: <p>I am using a datagridview to mirror my sql table using linq so:</p>
  
  <pre><code>var listOfCarRecords = dataGridView1.DataSource = record.Select(x =&gt; Mapper.Map&lt;Cars&gt;(x)).ToList();
  </code></pre>
  
  <p>This works fine.</p>
  
  <p>However my sql table has 60 columns of which only a few are ever contain data, there are few occassions when all contain data.</p>
  
  <p>So how can I show only columns with data in my datagridview?</p>
  
  <p>I tried setting <code>autogeneratecolumns = false</code>but it did not work.</p>
  
  <p>whats the simplest way to do this please?</p>
  
  <p>thank you</p>