DDR DDR - 2 months ago 22
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

Answer

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

Comments