DataGridViewRowCollection.RemoveAt(Int32) 方法

定義

從集合中移除位於指定之位置的資料列。

public:
 virtual void RemoveAt(int index);
public virtual void RemoveAt (int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Overridable Sub RemoveAt (index As Integer)

參數

index
Int32

要移除之資料列的位置。

例外狀況

index 小於零或大於集合中的資料列數目減一。

關聯的 DataGridView 控制項正在執行下列其中一個動作,會暫時防止加入新的資料列:

  • 選取控制項中的所有儲存格。

  • 清除選取範圍。

-或-

針對下列其中一個 DataGridView 事件 ,從處理常式呼叫這個方法:

-或-

index 等於集合中的資料列數目,且 DataGridViewAllowUserToAddRows 屬性設定為 true

-或-

關聯的 DataGridView 控制項繫結至 IBindingList 實作,但其 AllowRemoveSupportsChangeNotification 屬性值不是 true

適用於

另請參閱