Export (0) Print
Expand All

DataGridViewRowCollection Class

A collection of DataGridViewRow objects.

System.Object
  System.Windows.Forms.DataGridViewRowCollection

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[ListBindableAttribute(false)]
public class DataGridViewRowCollection : IList, 
	ICollection, IEnumerable

The DataGridViewRowCollection type exposes the following members.

  NameDescription
Public methodDataGridViewRowCollectionInitializes a new instance of the DataGridViewRowCollection class.
Top

  NameDescription
Public propertyCountGets the number of rows in the collection.
Protected propertyDataGridViewGets the DataGridView that owns the collection.
Public propertyItemGets the DataGridViewRow at the specified index.
Protected propertyListGets an array of DataGridViewRow objects.
Top

  NameDescription
Public methodAdd()Adds a new row to the collection.
Public methodAdd(DataGridViewRow)Adds the specified DataGridViewRow to the collection.
Public methodAdd(Int32)Adds the specified number of new rows to the collection.
Public methodAdd(Object[])Adds a new row to the collection, and populates the cells with the specified objects.
Public methodAddCopiesAdds the specified number of rows to the collection based on the row at the specified index.
Public methodAddCopyAdds a new row based on the row at the specified index.
Public methodAddRangeAdds the specified DataGridViewRow objects to the collection.
Public methodClearClears the collection.
Public methodContainsDetermines whether the specified DataGridViewRow is in the collection.
Public methodCopyToCopies the items from the collection into the specified DataGridViewRow array, starting at the specified index.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetFirstRow(DataGridViewElementStates)Returns the index of the first DataGridViewRow that meets the specified criteria.
Public methodGetFirstRow(DataGridViewElementStates, DataGridViewElementStates)Returns the index of the first DataGridViewRow that meets the specified inclusion and exclusion criteria.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLastRowReturns the index of the last DataGridViewRow that meets the specified criteria.
Public methodGetNextRow(Int32, DataGridViewElementStates)Returns the index of the next DataGridViewRow that meets the specified criteria.
Public methodGetNextRow(Int32, DataGridViewElementStates, DataGridViewElementStates)Returns the index of the next DataGridViewRow that meets the specified inclusion and exclusion criteria.
Public methodGetPreviousRow(Int32, DataGridViewElementStates)Returns the index of the previous DataGridViewRow that meets the specified criteria.
Public methodGetPreviousRow(Int32, DataGridViewElementStates, DataGridViewElementStates)Returns the index of the previous DataGridViewRow that meets the specified inclusion and exclusion criteria.
Public methodGetRowCountReturns the number of DataGridViewRow objects in the collection that meet the specified criteria.
Public methodGetRowsHeightReturns the cumulative height of the DataGridViewRow objects that meet the specified criteria.
Public methodGetRowStateGets the state of the row with the specified index.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIndexOfReturns the index of a specified item in the collection.
Public methodInsert(Int32, Int32)Inserts the specified number of rows into the collection at the specified location.
Public methodInsert(Int32, Object[])Inserts a row into the collection at the specified position, and populates the cells with the specified objects.
Public methodInsert(Int32, DataGridViewRow)Inserts the specified DataGridViewRow into the collection.
Public methodInsertCopiesInserts rows into the collection at the specified position.
Public methodInsertCopyInserts a row into the collection at the specified position, based on the row at specified position.
Public methodInsertRangeInserts the DataGridViewRow objects into the collection at the specified position.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnCollectionChangedRaises the CollectionChanged event.
Public methodRemoveRemoves the row from the collection.
Public methodRemoveAtRemoves the row at the specified position from the collection.
Public methodSharedRowReturns the DataGridViewRow at the specified index.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventCollectionChangedOccurs when the contents of the collection change.
Top

  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

  NameDescription
Explicit interface implemetationPrivate methodICollection.CopyToCopies the elements of the collection to an Array, starting at the specified index.
Explicit interface implemetationPrivate propertyICollection.CountGets the number of elements contained in the collection.
Explicit interface implemetationPrivate propertyICollection.IsSynchronizedGets a value indicating whether access to the collection is synchronized (thread safe).
Explicit interface implemetationPrivate propertyICollection.SyncRootGets an object that can be used to synchronize access to the collection.
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an enumerator that iterates through the collection.
Explicit interface implemetationPrivate methodIList.AddAdds a DataGridViewRow to the collection.
Explicit interface implemetationPrivate methodIList.ClearRemoves all items from the collection.
Explicit interface implemetationPrivate methodIList.ContainsDetermines whether the collection contains the specified item.
Explicit interface implemetationPrivate methodIList.IndexOfReturns the index of a specified item in the collection.
Explicit interface implemetationPrivate methodIList.InsertInserts a DataGridViewRow into the collection at the specified index.
Explicit interface implemetationPrivate propertyIList.IsFixedSizeGets a value indicating whether the collection has a fixed size.
Explicit interface implemetationPrivate propertyIList.IsReadOnlyGets a value indicating whether the collection is read-only.
Explicit interface implemetationPrivate propertyIList.ItemGets or sets the element at the specified index.
Explicit interface implemetationPrivate methodIList.RemoveRemoves the specified DataGridViewRow from the collection.
Explicit interface implemetationPrivate methodIList.RemoveAtRemoves the DataGridViewRow from the collection at the specified position.
Top

The DataGridViewRowCollection contains the DataGridViewRow objects in a DataGridView control. You can retrieve an instance of this class through the control Rows property. The collection maintains a reference to the control through the DataGridView property.

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.

For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft