Create one class as follows:
public class MyDataGridView : DataGridView { public new DataGridViewCell this[int col, int invertRow] { get { int recordCount = this.RowCount - (this.AllowUserToAddRows ? 2 : 1); return this.Rows[recordCount - invertRow].Cells[col]; } set { int recordCount = this.RowCount - (this.AllowUserToAddRows ? 2 : 1); this.Rows[recordCount - invertRow].Cells[col] = value; } } }
and name it like this:
dataGridView1[0, 0].Value = "a";
or if you want to set or get the first cell in the upper left corner of the grid, then you can use the FirstDisplayedCell property.
MSDN: Gets or sets the first cell currently displayed in the DataGridView; usually this cell is in the upper left corner.
For instance:
dataGridView1.FirstDisplayedCell.Value = "a";
source share