DataGridViewRow.GetState(Int32) 方法

定義

傳回值,指出資料列的目前狀態。

public:
 virtual System::Windows::Forms::DataGridViewElementStates GetState(int rowIndex);
public virtual System.Windows.Forms.DataGridViewElementStates GetState (int rowIndex);
abstract member GetState : int -> System.Windows.Forms.DataGridViewElementStates
override this.GetState : int -> System.Windows.Forms.DataGridViewElementStates
Public Overridable Function GetState (rowIndex As Integer) As DataGridViewElementStates

參數

rowIndex
Int32

資料列的索引。

傳回

DataGridViewElementStates 值的位元組合,指出資料列的狀態。

例外狀況

資料列已加入至 DataGridView 控制項,但 rowIndex 值不在 0 到控制項中資料列數減 1 的有效範圍中。

資料列不是共用資料列,但 rowIndex 值與資料列的 Index 屬性值不相符。

-或-

資料列尚未加入至 DataGridView 控制項,但 rowIndex 值與資料列的 Index 屬性值不相符。

備註

這個方法有助於判斷共用資料列的狀態。 共用資料列的 Index 值為 -1,這可防止您將 屬性與共享資料列搭配使用 State 。 若要使用這個方法,請傳入實際的資料列索引。 您可以呼叫 IndexOf 方法來擷取共用資料列的實際索引。

適用於

另請參閱