title: How do you prevent the Visual Studio designer auto-generating columns in a DataGridView?
body: <p>I generate all my columns in a subclassed <code>DataGridView</code> programmatically. However Visual Studio 2008 keeps reading my constructor class (which populates a <code>DataTable</code> with empty content and binds it to the <code>DataGridView</code>) and generates code for the columns in the <code>InitializeComponent</code> method - in the process setting <code>AutoGenerateColumns</code> to <code>false</code>.</p>
  
  <p>This causes errors in design-time compilation which are only solved by manually going into the design code and deleting all references to these autogenerated columns.</p>
  
  <p>How can I stop it doing this?</p>
  
  <p><b>I have tried:</b></p>
  
  <ul>
  <li>Making the control 'Frozen'</li>
  <li>Setting the <code>DataGridView</code> instantiated object <code>protected</code> (suggested in a previous post which referred to <a href="http://weblogs.asp.net/rweigelt/archive/2003/09/24/28984.aspx" rel="noreferrer">this site</a>)</li>
  </ul>