DataGridViewCellCollection Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a collection of cells in a DataGridViewRow.
public ref class DataGridViewCellCollection : System::Windows::Forms::BaseCollection, System::Collections::IList
[System.ComponentModel.ListBindable(false)]
public class DataGridViewCellCollection : System.Windows.Forms.BaseCollection, System.Collections.IList
[<System.ComponentModel.ListBindable(false)>]
type DataGridViewCellCollection = class
inherit BaseCollection
interface IList
interface ICollection
interface IEnumerable
Public Class DataGridViewCellCollection
Inherits BaseCollection
Implements IList
- Inheritance
- Attributes
- Implements
Remarks
DataGridViewCellCollection objects are retrieved by the DataGridViewRow.Cells property.
Constructors
| Name | Description |
|---|---|
| DataGridViewCellCollection(DataGridViewRow) |
Initializes a new instance of the DataGridViewCellCollection class. |
Properties
| Name | Description |
|---|---|
| Count |
Gets the total number of elements in the collection. (Inherited from BaseCollection) |
| IsReadOnly |
Gets a value indicating whether the collection is read-only. (Inherited from BaseCollection) |
| IsSynchronized |
Gets a value indicating whether access to the ICollection is synchronized. (Inherited from BaseCollection) |
| Item[Int32] |
Gets or sets the cell at the provided index location. In C#, this property is the indexer for the DataGridViewCellCollection class. |
| Item[String] |
Gets or sets the cell in the column with the provided name. In C#, this property is the indexer for the DataGridViewCellCollection class. |
| List |
Gets an ArrayList containing DataGridViewCellCollection objects. |
| SyncRoot |
Gets an object that can be used to synchronize access to the BaseCollection. (Inherited from BaseCollection) |
Methods
| Name | Description |
|---|---|
| Add(DataGridViewCell) |
Adds a cell to the collection. |
| AddRange(DataGridViewCell[]) |
Adds an array of cells to the collection. |
| Clear() |
Clears all cells from the collection. |
| Contains(DataGridViewCell) |
Determines whether the specified cell is contained in the collection. |
| CopyTo(Array, Int32) |
Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index. (Inherited from BaseCollection) |
| CopyTo(DataGridViewCell[], Int32) |
Copies the entire collection of cells into an array at a specified location within the array. |
| GetEnumerator() |
Gets the object that enables iterating through the members of the collection. (Inherited from BaseCollection) |
| IndexOf(DataGridViewCell) |
Returns the index of the specified cell. |
| Insert(Int32, DataGridViewCell) |
Inserts a cell into the collection at the specified index. |
| OnCollectionChanged(CollectionChangeEventArgs) |
Raises the CollectionChanged event. |
| Remove(DataGridViewCell) |
Removes the specified cell from the collection. |
| RemoveAt(Int32) |
Removes the cell at the specified index. |
Events
| Name | Description |
|---|---|
| CollectionChanged |
Occurs when the collection is changed. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copies the elements of the collection to the specified array, starting at the specified index. |
| ICollection.Count |
Gets the number of elements contained in the collection. |
| ICollection.IsSynchronized |
Gets a value indicating whether access to the collection is synchronized (thread safe). |
| ICollection.SyncRoot |
Gets an object that can be used to synchronize access to the collection. |
| IEnumerable.GetEnumerator() |
Returns an enumerator that iterates through a collection. |
| IList.Add(Object) |
Adds an item to the collection. |
| IList.Clear() |
Clears the collection. |
| IList.Contains(Object) |
Determines whether the collection contains the specified value. |
| IList.IndexOf(Object) |
Determines the index of a specific item in a collection. |
| IList.Insert(Int32, Object) |
Inserts an item into the collection at the specified position. |
| IList.IsFixedSize |
Gets a value indicating whether the collection has a fixed size. |
| IList.IsReadOnly |
Gets a value indicating whether the collection has a fixed size. |
| IList.Item[Int32] |
Gets or sets the element at the specified index. |
| IList.Remove(Object) |
Removes the first occurrence of a specific object from the collection. |
| IList.RemoveAt(Int32) |
Removes the DataGridViewCell at the specified index. |