title: Adding new columns to a Winforms DataGridView via code
body: <p>I'm trying to add N number of columns for each days of a given month:</p>
  
  <pre><code>var daysCount = DateTime.DaysInMonth(DateTime.Now.Year, month);
  
  for (int i = 1; i &lt;= daysCount; i++)
  {
      dataGridView1.Columns.Add(new DataGridViewColumn() { HeaderText = i.ToString() });
  }
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>At least one of the DataGridView
    control's columns has no cell
    template.</p>
  </blockquote>