DataGridViewCellCollection.IList.Add(Object) Method

Definition

Adds an item to the collection.

 virtual int System.Collections.IList.Add(System::Object ^ value) = System::Collections::IList::Add;
int IList.Add (object value);
Function Add (value As Object) As Integer Implements IList.Add

Parameters

value
Object

The DataGridViewCell to add to the collection.

Returns

The position into which the new element was inserted.

Implements

Exceptions

The row that owns this DataGridViewCellCollection already belongs to a DataGridView control.

-or-

value represents a cell that already belongs to a DataGridViewRow.

Remarks

Once you add the row to a control, the number of cells it contains always matches the number of columns in the control, so this method is no longer useful.

This member is an explicit interface member implementation. It can be used only when the DataGridViewCellCollection instance is cast to an IList interface.

Applies to

See also