title: Help with adding checkbox column to DataGridView in window form
body: <p>I am trying to add a checkbox column to a DataGridView in a simple window forms application.</p>
  
  <p>I am pulling back some data from a database using ADO.NET, putting into a datatable, and then setting the datagridview datasource to the datatable. I then want to add a checkbox column as the second column. So far I have this code that seems to work:</p>
  
  <pre><code>' Code here to connect to database
  Dim da As New SqlDataAdapter(cmd)
  Dim dt As New DataTable
  da.Fill(dt)
  
  MainForm.MyDataGridView.DataSource = dt
  
  Dim ChkBox As New DataGridViewCheckBoxColumn
  
  ChkBox.FlatStyle = FlatStyle.Standard
  MainForm.MyDataGridView.Columns.Insert(1, ChkBox)
  </code></pre>
  
  <p>This code 'works' and I get MyDataGridView to show the data with the checkbox column in the correct position in the table.</p>
  
  <p>However, for some reason, I cannot check any of the check boxes in the DataGridView? I have tried lots of things (e.g.altering the readonly state of the column) but cannot get it to work.</p>
  
  <p>Is there something obvious that I am missing?</p>