Change the Header Names in the DataGridView
If the columns being retrieved from the
database do not have meaningful names, we always have the option of changing
the header names as shown in this snippet:
C#
private void btnChange_Click(object
sender, EventArgs e)
{
dgv.Columns[0].HeaderText = "MyHeader1";
dgv.Columns[1].HeaderText = "MyHeader2";
}
No comments:
Post a Comment