Try something like this:
string str = dataGridView1.Columns[0].HeaderText;
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Hi, to add to ddanbe`s post.
You can do it this way too:
foreach (DataGridViewRow row in dataGridView1.Rows)
{
foreach (DataGridViewCell cell in row.Cells)
{
//CELL here does not have a property of HeaderText.
//so you can do it like ddanbe showed or:
string header = dataGridView1.Columns[cell.ColumnIndex].HeaderText;
}
}
Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
abelLazm
Postaholic
2,113 posts since Feb 2011
Reputation Points: 219
Solved Threads: 124