Redigera

Dela via


DataGridViewCell.GetValue(Int32) Method

Definition

Gets the value of the cell.

protected:
 virtual System::Object ^ GetValue(int rowIndex);
protected virtual object GetValue (int rowIndex);
protected virtual object? GetValue (int rowIndex);
abstract member GetValue : int -> obj
override this.GetValue : int -> obj
Protected Overridable Function GetValue (rowIndex As Integer) As Object

Parameters

rowIndex
Int32

The index of the cell's parent row.

Returns

The value contained in the DataGridViewCell.

Exceptions

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.

Remarks

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.

Applies to

See also