Adding Text to DataGridView Row Header


Does C# allow you to add a String to a RowHeader in a DataGridView? If so, how is it accomplished?

I'm writing a Windows Form to displayed Customer Payment Data for the year so far.

The ColumnHeaders display January, February, March, etc... and rather than have a blank column with DateTime.Now.Year I would like to put it in the RowHeader to make it stand out from the actual payment data.

11/19/2009 8:23:13 PM

private void dtgworkingdays_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)

private void FillRecordNo()
    for (int i = 0; i < this.dtworkingdays.Rows.Count; i++)
        this.dtgworkingdays.Rows[i].HeaderCell.Value = (i + 1).ToString();

Also see Show row number in row header of a DataGridView.

5/6/2019 10:53:20 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow