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.
To hide a column programmaticallySet the DataGridViewColumn. Visible property to false .
DataGridView's column index starts from zero. Hence, if you want to hide first column, you can do, dataGridView1. Columns[0].
The way to hide a column in a DataBound GridView is to trap the RowCreated Event and set a Cell inside the column of the row to Visible = false.
To hide first column you can set RowHeadersVisible
to false of your dataGrid
Just set the Background-Color and the RowHeadersVisible-State of your DataGridView:
dataGridView1.BackgroundColor = Color.White; dataGridView1.RowHeadersVisible = false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With