DDR DDR - 1 month ago 9x
C# Question

Hiding default gray column in datagridview winform

Is there any way to remove or hide winform's datagrid gray area when data is not avaiable?

Second this how to remove/hide the default gray column?

dataGridView1.DataSource = oresult;
dataGridView1.Columns["Id"].Visible = false;
dataGridView1.Columns["AddedBy"].Visible = false;
dataGridView1.Columns["AddmissionInClass"].Visible = false;
dataGridView1.Columns["IsDeleted"].Visible = false;
dataGridView1.Enabled = false;

I'm hiding useless columns like this but unable to find way to hide these.

enter image description here


To hide first column you can set RowHeadersVisible to false of your dataGrid