I checked on other postings and suggested to make the EnableHeadersVisualStyles = false but that only lets me color them. I want to change their names, but they don’t change when I force the name as shown below.
Products prod = new Products();
DataTable dt = prod.GetTopTenTransactions(Global.Instance.Accounts[0]);
transactionGrid.DataSource = dt;
foreach (DataGridViewColumn cols in transactionGrid.Columns)
{
cols.Width = 70;
}
transactionGrid.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
transactionGrid.EnableHeadersVisualStyles = false;
transactionGrid.Columns[0].Name = "ID";
transactionGrid.Columns[1].Name = "TYPE";
transactionGrid.Columns[2].Name = "DATE";
transactionGrid.Columns[3].Name = "AMOUNT";
transactionGrid.Columns[4].Name = "FROM";
transactionGrid.Columns[5].Name = "TO";
transactionGrid.Columns[6].Name = "TELLER ID";
Any help would be much appreciated.
DataGridViewColumn.Name is used to identify column in collection.
Try to use DataGridViewColumn.HeaderText instead.