Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataGridView Edit Column Names

Is there any way to edit column names in a DataGridView?

like image 303
Dested Avatar asked Sep 24 '08 06:09

Dested


2 Answers

You can also change the column name by using:

myDataGrid.Columns[0].HeaderText = "My Header"

but the myDataGrid will need to have been bound to a DataSource.

like image 137
Ryan Spears Avatar answered Sep 23 '22 17:09

Ryan Spears


You can edit the header directly:

dataGridView1.Columns[0].HeaderCell.Value = "Created";
dataGridView1.Columns[1].HeaderCell.Value = "Name";

And so on for as many columns you have.

like image 23
Bjørn Otto Vasbotten Avatar answered Sep 22 '22 17:09

Bjørn Otto Vasbotten