DataGridView ID Column Will Not Hide

Suggestion 1:
Try explicitly setting the DGV Column's Visible property to false in the FormLoad event:

dataGridView.Columns["YourIdColumn"].Visible = false;

Suggestion 2:
Try changing your column dgvActiveMinersRecordId from the first column in the DGV to the last column.


To try and answer this a bit more generically for the next person who comes along, like me...

This does seem to be a bug, but the work around is to:

Make sure the columns you want to hide are displayed last

This will depend on your code, but for some this will be:

  • SQL code changed to return the columns later
  • Change the code that adds the datagridview columns putting the "to hide" columns at the end
  • Setting the Columns[x].DisplayIndex such that the columns appear last, as per @Steve's post