DataGridViewCell.GetValue(Int32) 方法

定义

获取单元格的值。Gets the value of the cell.

protected:
 virtual System::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

参数

rowIndex
Int32

该单元格的父行索引。The index of the cell's parent row.

返回

DataGridViewCell 中包含的值。The value contained in the DataGridViewCell.

异常

单元格的 DataGridView 属性值不是 null,而且 rowIndex 小于 0 或者大于或等于父 DataGridView 中的行数。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.

该单元格的 DataGridView 属性的值不为 null,并且ColumnIndex 属性的值小于 0,这表示该单元格为行标头单元格。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.

注解

GetValue 方法传递用于检索 DataGridViewCell的行索引。Pass the GetValue method the row index you used to retrieve the DataGridViewCell. 不要使用 rowIndex 参数的 RowIndex 属性。Do not use the RowIndex property for the rowIndex parameter. 如果行是共享的,则 RowIndex 为-1,该值不是 rowIndex的有效值。If the row is shared, RowIndex is -1, which is not a valid value for rowIndex.

适用于

另请参阅