C# – How to hide a specific column form a dataGridView

cwinforms

How can I hide a specific Column in DataGridview along with its header
while being able to use its value ? ( just doesn't get shown ) .
The following code doesn't work.

 gridview.Rows[e.RowIndex].Cells[11].Visible = false;

Best Answer

Try this:

gridview.Columns["ColumnName"].Visible = false;

Hide Columns in the Windows Forms DataGridView Control