DataGridViewRowCollection 類別

定義

DataGridViewRow 物件的集合。

public ref class DataGridViewRowCollection : System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class DataGridViewRowCollection : System.Collections.IList
[<System.ComponentModel.ListBindable(false)>]
type DataGridViewRowCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
[<System.ComponentModel.ListBindable(false)>]
type DataGridViewRowCollection = class
    interface ICollection
    interface IEnumerable
    interface IList
Public Class DataGridViewRowCollection
Implements IList
繼承
DataGridViewRowCollection
屬性
實作

備註

DataGridViewRowCollection包含 DataGridViewRow 控制件中的 DataGridView 物件。 您可以透過控件 Rows 屬性擷取這個類別的實例。 集合會透過屬性維護控件的 DataGridView 參考。

若要改善效能,包含 DataGridViewRowCollection 共用和未共享的數據列。 共用數據列會共用記憶體,以減少大型記錄集的成本。 如果您的記錄集非常大,您應該小心盡可能保留共享的數據列。

如需詳細資訊,請參閱 縮放 Windows Form DataGridView 控制項的最佳做法

建構函式

DataGridViewRowCollection(DataGridView)

初始化 DataGridViewRowCollection 類別的新執行個體。

屬性

Count

取得此集合中的資料列數目。

DataGridView

取得擁有集合的 DataGridView

Item[Int32]

取得指定索引處的 DataGridViewRow

List

取得 DataGridViewRow 物件的陣列。

方法

Add()

將新資料列加入集合。

Add(DataGridViewRow)

將指定的 DataGridViewRow 加入至集合。

Add(Int32)

將指定數目的新資料列加入該集合。

Add(Object[])

將新的資料列加入集合中,並填入具有指定物件的儲存格。

AddCopies(Int32, Int32)

根據指定索引的資料列,將指定的資料列數加入集合。

AddCopy(Int32)

以指定索引處的資料列為基底加入新的資料列。

AddRange(DataGridViewRow[])

將指定的 DataGridViewRow 物件加入該集合。

Clear()

清除集合。

Contains(DataGridViewRow)

判斷集合中是否有指定的 DataGridViewRow

CopyTo(DataGridViewRow[], Int32)

將來自此集合的項目複製到以指定的索引為起始點之指定的 DataGridViewRow 陣列。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetFirstRow(DataGridViewElementStates)

傳回符合指定準則之第一個 DataGridViewRow 的索引。

GetFirstRow(DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之第一個 DataGridViewRow 的索引。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetLastRow(DataGridViewElementStates)

傳回符合指定準則之最後一個 DataGridViewRow 的索引。

GetNextRow(Int32, DataGridViewElementStates)

傳回下一個 DataGridViewRow 的索引,其符合指定的準則。

GetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之下一個 DataGridViewRow 的索引。

GetPreviousRow(Int32, DataGridViewElementStates)

傳回符合指定準則之上一個 DataGridViewRow 的索引。

GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之先前 DataGridViewRow 的索引。

GetRowCount(DataGridViewElementStates)

傳回集合中符合指定準則的 DataGridViewRow 物件數目。

GetRowsHeight(DataGridViewElementStates)

傳回符合指定準則之 DataGridViewRow 物件的累計高度。

GetRowState(Int32)

取得具有指定索引的資料列狀態。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IndexOf(DataGridViewRow)

傳回集合中之指定項目的索引。

Insert(Int32, DataGridViewRow)

將指定的 DataGridViewRow 插入集合。

Insert(Int32, Int32)

將指定的資料列數插入在指定位置的集合。

Insert(Int32, Object[])

將資料列插入集合中的指定位置,並將指定物件填入儲存格。

InsertCopies(Int32, Int32, Int32)

將資料列插入位在指定位置中的集合。

InsertCopy(Int32, Int32)

根據位於指定位置的資料列,在指定的位置將資料列插入集合中。

InsertRange(Int32, DataGridViewRow[])

DataGridViewRow 物件插入位在指定位置中的集合。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnCollectionChanged(CollectionChangeEventArgs)

引發 CollectionChanged 事件。

Remove(DataGridViewRow)

從集合中移除資料列。

RemoveAt(Int32)

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

SharedRow(Int32)

傳回指定索引處的 DataGridViewRow

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

事件

CollectionChanged

當集合的內容變更時發生。

明確介面實作

ICollection.CopyTo(Array, Int32)

從指定的索引開始,將集合的項目複製到 Array

ICollection.Count

取得集合所包含的項目數目。

ICollection.IsSynchronized

取得值,表示是否同步化存取集合 (執行緒安全)。

ICollection.SyncRoot

取得物件,這個物件可以用來對集合進行同步存取。

IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。

IList.Add(Object)

DataGridViewRow 加入集合。

IList.Clear()

移除集合的所有項目。

IList.Contains(Object)

指出集合是否含有指定的項目。

IList.IndexOf(Object)

傳回集合中之指定項目的索引。

IList.Insert(Int32, Object)

DataGridViewRow 插入集合中指定的索引處。

IList.IsFixedSize

取得值,這個值表示集合的大小是否是固定的。

IList.IsReadOnly

取得值,表示集合是否為唯讀。

IList.Item[Int32]

在指定的索引位置上取得或設定項目。

IList.Remove(Object)

從集合移除指定的 DataGridViewRow

IList.RemoveAt(Int32)

從集合中指定的位置移除 DataGridViewRow

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱