VB.NET
Dim i As Integer
For i = 0 To dgv1.Rows.Count - 1
dgv1.Rows(i).HeaderCell.Value = i.ToString()
Next i
dgv1.AutoResizeRowHeadersWidth( _
DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders)
C#for (int i = 0; i < dgv1.Rows.Count; i++)
{
dgv1.Rows[i].HeaderCell.Value = i.ToString();
}
dgv1.AutoResizeRowHeadersWidth(
DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
DataGridViewの左上の固定セルに文字を表示する方法VB.NET
dgv1.TopLeftHeaderCell.Value = "@"
C#dgv1.TopLeftHeaderCell.Value = "@";