I am successfully displaying a DataTable with two columns as the DataSource in a DataGridView. The second column contains an internal reference code which I need but would like to hide.

The method given by MSDN http://windowssdk.msdn.microsoft.com...b7c7e5be15.asp seems to exactly apply:
Code:
dataGridView1.AutoGenerateColumns = true;
dataGridView1.DataSource = MyDataSet;
dataGridView1.Columns[MyColumnHeaderName].Visible = false;
However the MSDN method fails at the third line in VS2005 because Columns.Count == 0. Does anyone have a workaround for this bug?