DataGridViewCell.GetValue(Int32) DataGridViewCell.GetValue(Int32) DataGridViewCell.GetValue(Int32) DataGridViewCell.GetValue(Int32) Method


取得儲存格的值。Gets the value of the cell.

 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


Int32 Int32 Int32 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.


將您用來取得的DataGridViewCell資料列索引傳遞給方法。GetValuePass 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.