Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extra Column in DatagridView C# [duplicate]

How to remove the extra column in the Left with * in DataGridView?

enter image description here

like image 916
Lemon Avatar asked Jun 29 '26 17:06

Lemon


1 Answers

Set the RowHeadersVisible to false.

dataGridView1.RowHeadersVisible = false;

(I know its name is quite misleading but it works :))

For the following code:

dataGridView1.RowHeadersVisible = false;
DataTable dt = new DataTable();
dt.Columns.Add("Name");
dt.Columns.Add("Address");
dt.Rows.Add("ABC", "DEF");
dt.Rows.Add("XYZ", "DEF");
dt.Rows.Add("EFG", "HIJ");
dataGridView1.DataSource = dt;

You will get like:

enter image description here

Without that property set to false, it will appear as:

enter image description here

like image 117
Habib Avatar answered Jul 01 '26 06:07

Habib



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!