DataGridViewCellCollection
Wisej.Web.DataGridViewCellCollection
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.0.0.0)
Represents a collection of cells in a DataGridViewRow.
public class DataGridViewCellCollection : BaseCollection, IList, IList<DataGridViewCell>, ICollection<DataGridViewCell>, IEnumerable<DataGridViewCell>Public Class DataGridViewCellCollection
    Inherits BaseCollection
    Implements IList, IList(Of DataGridViewCell), ICollection(Of DataGridViewCell), IEnumerable(Of DataGridViewCell)Constructors
 DataGridViewCellCollection(row)
 DataGridViewCellCollection(row)
 DataGridViewCellCollection(row)
 DataGridViewCellCollection(row)Initializes a new instance of the DataGridViewCellCollection class.
Properties
 Item(column)
 Item(column)
 Item(column)
 Item(column)DataGridViewCell: Returns or sets the cell contained in the specified column .
Throws:
- ArgumentNullException The specified value when setting this property is null; or column is null. 
- InvalidOperationException The specified cell when setting this property already belongs to a DataGridView control, or the specified cell when setting this property already belongs to a DataGridViewRow 
- ArgumentNullExceptioncolumn is null. 
- ArgumentException The specified column does not belong to the same DataGridView that owns the cells. 
- ArgumentOutOfRangeException The index of the specified column is less than 0 or is equal to or greater than the number of cells in the collection. 
 Item(index)
 Item(index)
 Item(index)
 Item(index)DataGridViewCell: Returns or sets the cell at the provided index location.
Throws:
- ArgumentNullException The specified value when setting this property is null. 
- InvalidOperationException The specified cell when setting this property already belongs to a DataGridView control, or the specified cell when setting this property already belongs to a DataGridViewRow. 
- ArgumentOutOfRangeExceptionindex is less than 0 or index is equal to or greater than the number of cells in the collection. 
 Item(columnName)
 Item(columnName)
 Item(columnName)
 Item(columnName)DataGridViewCell: Returns or sets the cell in the column with the provided name.
Throws:
- ArgumentExceptioncolumnName does not match the name of any columns in the control. 
- ArgumentNullException The specified value when setting this property is null; or columnName is null. 
- InvalidOperationException The specified cell when setting this property already belongs to a DataGridView control, or the specified cell when setting this property already belongs to a DataGridViewRow. 
 List
 List
 List
 ListIList: Returns the collection.
Methods
 Add(cell)
 Add(cell)
 Add(cell)
 Add(cell)Adds a cell to the collection.
Returns: Int32. The position in which to insert the new element.
Throws:
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control, or cell already belongs to a DataGridViewRow. 
 AddRange(cells)
 AddRange(cells)
 AddRange(cells)
 AddRange(cells)Adds an array of cells to the collection.
Throws:
- ArgumentNullExceptioncells is null. 
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control, or at least one value in cells is null, or at least one cell in cells already belongs to a DataGridViewRow, or at least two values in cells are references to the same DataGridViewCell. 
 AddRangeInternal(cells)
 AddRangeInternal(cells)
 AddRangeInternal(cells)
 AddRangeInternal(cells)Adds an array of cells to the collection.
Throws:
- ArgumentNullExceptioncells is null. 
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control, or at least one value in cells is null, or at least one cell in cells already belongs to a DataGridViewRow, or at least two values in cells are references to the same DataGridViewCell. 
 Clear()
 Clear()
 Clear()
 Clear()Clears all cells from the collection.
Throws:
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control. 
 Contains(cell)
 Contains(cell)
 Contains(cell)
 Contains(cell)Determines whether the specified cell is contained in the collection.
Returns: Boolean. true if cell is in the collection; otherwise, false.
 CopyTo(array, index)
 CopyTo(array, index)
 CopyTo(array, index)
 CopyTo(array, index)Copies the entire collection of cells into an array at a specified location within the array.
 IndexOf(cell)
 IndexOf(cell)
 IndexOf(cell)
 IndexOf(cell)Returns the index of the specified cell.
Returns: Int32. The zero-based index of the value of cell parameter, if it is found in the collection; otherwise, -1.
 Insert(index, cell)
 Insert(index, cell)
 Insert(index, cell)
 Insert(index, cell)Inserts a cell into the collection at the specified index.
Throws:
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control, or cell already belongs to a DataGridViewRow. 
 OnCollectionChanged(action, element)
 OnCollectionChanged(action, element)
 OnCollectionChanged(action, element)
 OnCollectionChanged(action, element)Fires the CollectionChanged event.
action
One of CollectionChangeAction indicating the reason the collection has changed.
 Remove(cell)
 Remove(cell)
 Remove(cell)
 Remove(cell)Removes the specified cell from the collection.
Throws:
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control. 
- ArgumentExceptioncell could not be found in the collection. 
 RemoveAt(index)
 RemoveAt(index)
 RemoveAt(index)
 RemoveAt(index)Removes the cell at the specified index.
Throws:
- InvalidOperationException The row that owns this DataGridViewCellCollection already belongs to a DataGridView control. 
Events
 CollectionChanged
 CollectionChanged
 CollectionChanged
 CollectionChangedCollectionChangeEventHandler Fired when the collection changes.
Last updated
Was this helpful?

