DataGridViewRowCollection DataGridViewRowCollection DataGridViewRowCollection DataGridViewRowCollection Class

定義

DataGridViewRow 物件的集合。A collection of DataGridViewRow objects.

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

備註

DataGridViewRowCollection包含DataGridViewRow中的物件DataGridView控制項。The DataGridViewRowCollection contains the DataGridViewRow objects in a DataGridView control. 您可以擷取此類別透過控制項的執行個體Rows屬性。You can retrieve an instance of this class through the control Rows property. 集合會維護透過控制項的參考DataGridView屬性。The collection maintains a reference to the control through the DataGridView property.

為了改善效能,DataGridViewRowCollection包含共用和非共用的資料列。To improve performance, a DataGridViewRowCollection includes shared and unshared rows. 共用的資料列共用記憶體,以減少大型的記錄集的成本。Shared rows share memory to reduce the cost of a large record set. 如果您的資料錄集非常大,您應該小心保留共用資料列的最大的。If your record set is very large, you should be careful to keep the rows shared as much as possible.

如需詳細資訊,請參閱 < 縮放 Windows Form DataGridView 控制項的最佳作法For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

建構函式

DataGridViewRowCollection(DataGridView) DataGridViewRowCollection(DataGridView) DataGridViewRowCollection(DataGridView) DataGridViewRowCollection(DataGridView)

初始化 DataGridViewRowCollection 類別的新執行個體。Initializes a new instance of the DataGridViewRowCollection class.

屬性

Count Count Count Count

取得此集合中的資料列數目。Gets the number of rows in the collection.

DataGridView DataGridView DataGridView DataGridView

取得擁有集合的 DataGridViewGets the DataGridView that owns the collection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

取得指定索引處的 DataGridViewRowGets the DataGridViewRow at the specified index.

List List List List

取得 DataGridViewRow 物件的陣列。Gets an array of DataGridViewRow objects.

方法

Add() Add() Add() Add()

將新資料列加入集合。Adds a new row to the collection.

Add(DataGridViewRow) Add(DataGridViewRow) Add(DataGridViewRow) Add(DataGridViewRow)

將指定的 DataGridViewRow 加入至集合。Adds the specified DataGridViewRow to the collection.

Add(Int32) Add(Int32) Add(Int32) Add(Int32)

將指定數目的新資料列加入該集合。Adds the specified number of new rows to the collection.

Add(Object[]) Add(Object[]) Add(Object[]) Add(Object[])

將新的資料列加入集合中,並填入具有指定物件的儲存格。Adds a new row to the collection, and populates the cells with the specified objects.

AddCopies(Int32, Int32) AddCopies(Int32, Int32) AddCopies(Int32, Int32) AddCopies(Int32, Int32)

根據指定索引的資料列,將指定的資料列數加入集合。Adds the specified number of rows to the collection based on the row at the specified index.

AddCopy(Int32) AddCopy(Int32) AddCopy(Int32) AddCopy(Int32)

以指定索引處的資料列為基底加入新的資料列。Adds a new row based on the row at the specified index.

AddRange(DataGridViewRow[]) AddRange(DataGridViewRow[]) AddRange(DataGridViewRow[]) AddRange(DataGridViewRow[])

將指定的 DataGridViewRow 物件加入該集合。Adds the specified DataGridViewRow objects to the collection.

Clear() Clear() Clear() Clear()

清除集合。Clears the collection.

Contains(DataGridViewRow) Contains(DataGridViewRow) Contains(DataGridViewRow) Contains(DataGridViewRow)

判斷集合中是否有指定的 DataGridViewRowDetermines whether the specified DataGridViewRow is in the collection.

CopyTo(DataGridViewRow[], Int32) CopyTo(DataGridViewRow[], Int32) CopyTo(DataGridViewRow[], Int32) CopyTo(DataGridViewRow[], Int32)

將來自此集合的項目複製到以指定的索引為起始點之指定的 DataGridViewRow 陣列。Copies the items from the collection into the specified DataGridViewRow array, starting at the specified index.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetFirstRow(DataGridViewElementStates) GetFirstRow(DataGridViewElementStates) GetFirstRow(DataGridViewElementStates) GetFirstRow(DataGridViewElementStates)

傳回符合指定準則之第一個 DataGridViewRow 的索引。Returns the index of the first DataGridViewRow that meets the specified criteria.

GetFirstRow(DataGridViewElementStates, DataGridViewElementStates) GetFirstRow(DataGridViewElementStates, DataGridViewElementStates) GetFirstRow(DataGridViewElementStates, DataGridViewElementStates) GetFirstRow(DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之第一個 DataGridViewRow 的索引。Returns the index of the first DataGridViewRow that meets the specified inclusion and exclusion criteria.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetLastRow(DataGridViewElementStates) GetLastRow(DataGridViewElementStates) GetLastRow(DataGridViewElementStates) GetLastRow(DataGridViewElementStates)

傳回符合指定準則之最後一個 DataGridViewRow 的索引。Returns the index of the last DataGridViewRow that meets the specified criteria.

GetNextRow(Int32, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates)

傳回下一個 DataGridViewRow 的索引,其符合指定的準則。Returns the index of the next DataGridViewRow that meets the specified criteria.

GetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之下一個 DataGridViewRow 的索引。Returns the index of the next DataGridViewRow that meets the specified inclusion and exclusion criteria.

GetPreviousRow(Int32, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates)

傳回符合指定準則之上一個 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified criteria.

GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates) GetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates)

傳回符合指定的包含和排除準則之先前 DataGridViewRow 的索引。Returns the index of the previous DataGridViewRow that meets the specified inclusion and exclusion criteria.

GetRowCount(DataGridViewElementStates) GetRowCount(DataGridViewElementStates) GetRowCount(DataGridViewElementStates) GetRowCount(DataGridViewElementStates)

傳回集合中符合指定準則的 DataGridViewRow 物件數目。Returns the number of DataGridViewRow objects in the collection that meet the specified criteria.

GetRowsHeight(DataGridViewElementStates) GetRowsHeight(DataGridViewElementStates) GetRowsHeight(DataGridViewElementStates) GetRowsHeight(DataGridViewElementStates)

傳回符合指定準則之 DataGridViewRow 物件的累計高度。Returns the cumulative height of the DataGridViewRow objects that meet the specified criteria.

GetRowState(Int32) GetRowState(Int32) GetRowState(Int32) GetRowState(Int32)

取得具有指定索引的資料列狀態。Gets the state of the row with the specified index.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(DataGridViewRow) IndexOf(DataGridViewRow) IndexOf(DataGridViewRow) IndexOf(DataGridViewRow)

傳回集合中之指定項目的索引。Returns the index of a specified item in the collection.

Insert(Int32, DataGridViewRow) Insert(Int32, DataGridViewRow) Insert(Int32, DataGridViewRow) Insert(Int32, DataGridViewRow)

將指定的 DataGridViewRow 插入集合。Inserts the specified DataGridViewRow into the collection.

Insert(Int32, Int32) Insert(Int32, Int32) Insert(Int32, Int32) Insert(Int32, Int32)

將指定的資料列數插入在指定位置的集合。Inserts the specified number of rows into the collection at the specified location.

Insert(Int32, Object[]) Insert(Int32, Object[]) Insert(Int32, Object[]) Insert(Int32, Object[])

將資料列插入集合中的指定位置,並將指定物件填入儲存格。Inserts a row into the collection at the specified position, and populates the cells with the specified objects.

InsertCopies(Int32, Int32, Int32) InsertCopies(Int32, Int32, Int32) InsertCopies(Int32, Int32, Int32) InsertCopies(Int32, Int32, Int32)

將資料列插入位在指定位置中的集合。Inserts rows into the collection at the specified position.

InsertCopy(Int32, Int32) InsertCopy(Int32, Int32) InsertCopy(Int32, Int32) InsertCopy(Int32, Int32)

根據位於指定位置的資料列,在指定的位置將資料列插入集合中。Inserts a row into the collection at the specified position, based on the row at specified position.

InsertRange(Int32, DataGridViewRow[]) InsertRange(Int32, DataGridViewRow[]) InsertRange(Int32, DataGridViewRow[]) InsertRange(Int32, DataGridViewRow[])

DataGridViewRow 物件插入位在指定位置中的集合。Inserts the DataGridViewRow objects into the collection at the specified position.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs)

引發 CollectionChanged 事件。Raises the CollectionChanged event.

Remove(DataGridViewRow) Remove(DataGridViewRow) Remove(DataGridViewRow) Remove(DataGridViewRow)

從集合中移除資料列。Removes the row from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

從集合中移除位於指定之位置的資料列。Removes the row at the specified position from the collection.

SharedRow(Int32) SharedRow(Int32) SharedRow(Int32) SharedRow(Int32)

傳回指定索引處的 DataGridViewRowReturns the DataGridViewRow at the specified index.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

事件

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

當集合的內容變更時發生。Occurs when the contents of the collection change.

明確介面實作

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

從指定的索引開始,將集合的項目複製到 ArrayCopies the elements of the collection to an Array, starting at the specified index.

ICollection.Count ICollection.Count ICollection.Count ICollection.Count

取得集合所包含的項目數目。Gets the number of elements contained in the collection.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

取得值,表示是否同步化存取集合 (執行緒安全)。Gets a value indicating whether access to the collection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

取得物件,這個物件可以用來對集合進行同步存取。Gets an object that can be used to synchronize access to the collection.

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

傳回逐一查看集合的列舉值。Returns an enumerator that iterates through the collection.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

DataGridViewRow 加入集合。Adds a DataGridViewRow to the collection.

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

移除集合的所有項目。Removes all items from the collection.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

指出集合是否含有指定的項目。Determines whether the collection contains the specified item.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

傳回集合中之指定項目的索引。Returns the index of a specified item in the collection.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

DataGridViewRow 插入至索引中的指定索引處。Inserts a DataGridViewRow into the collection at the specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

取得值,這個值表示集合的大小是否是固定的。Gets a value indicating whether the collection has a fixed size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

取得值,表示集合是否為唯讀。Gets a value indicating whether the collection is read-only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

在指定的索引位置上取得或設定項目。Gets or sets the element at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

從集合移除指定的 DataGridViewRowRemoves the specified DataGridViewRow from the collection.

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

從集合中指定的位置移除 DataGridViewRowRemoves the DataGridViewRow from the collection at the specified position.

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱