DDR DDR - 1 year ago 224
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 Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download