Gets the value of the cell.
protected virtual Object GetValue(
The index of the cell's parent row.
The value of the DataGridView property of the cell is not null and rowIndex is less than 0 or greater than or equal to the number of rows in the parent DataGridView.
The value of the DataGridView property of the cell is not null and the value of the ColumnIndex property is less than 0, indicating that the cell is a row header cell.
Pass the GetValue method the row index you used to retrieve the DataGridViewCell. Do not use the RowIndex property for the rowIndex parameter. If the row is shared, RowIndex is -1, which is not a valid value for rowIndex.