Skip to main content
Version: 4.1

DataGridViewRowCollection

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

A collection of DataGridViewRow objects.

public class DataGridViewRowCollection : IList, ICollection, IEnumerable, IList<DataGridViewRow>, ICollection<DataGridViewRow>, IEnumerable<DataGridViewRow>

Constructors

Instance member DataGridViewRowCollection(dataGrid)

Initializes a new instance of the DataGridViewRowCollection class for the given DataGridView.

NameTypeDescription
dataGridDataGridViewThe DataGridView that created this collection.

Properties

Instance member Count

Int32: Returns the number of rows in the collection.

Instance member Item(index)

DataGridViewRow: Returns the DataGridViewRow at the specified index.

Throws:

Methods

Instance member Add()

Adds a new DataGridViewRow to the collection.

Returns: Int32. The index of the new DataGridViewRow.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member Add(values)

Adds a new DataGridViewRow to the collection, and populates the cells with the specified objects.

ParameterTypeDescription
valuesObject[]A variable number of objects that populate the cells of the new DataGridViewRow.

Returns: Int32. The index of the new DataGridViewRow.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Or the VirtualMode property of the DataGridView is set to true.

Or the row returned by the RowTemplate property has more cells than there are columns in the control.

Instance member Add(row)

Adds the specified DataGridViewRow to the collection.

ParameterTypeDescription
rowDataGridViewRowThe DataGridViewRow to add to the DataGridViewRowCollection.

Returns: Int32. The index of the new DataGridViewRow.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member Add(count)

Adds the specified number of new rows to the collection.

ParameterTypeDescription
countInt32The number of rows to add to the DataGridViewRowCollection.

Returns: Int32. The index of the last row that was added.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member AddCopies(rowIndex, count)

Adds the specified number of rows to the collection based on the row at the specified index.

ParameterTypeDescription
rowIndexInt32The index of the row on which to base the new rows.
countInt32The number of rows to add to the DataGridViewRowCollection.

Returns: Int32. The index of the last row that was added.

Throws:

Instance member AddCopy(rowIndex)

Adds a DataGridViewRow row based on the DataGridViewRow at the specified index.

ParameterTypeDescription
rowIndexInt32The index of the row on which to base the new row.

Returns: Int32. The index of the new DataGridViewRow.

Throws:

Instance member AddRange(newRows)

Adds the specified DataGridViewRow objects to the collection.

ParameterTypeDescription
newRowsDataGridViewRow[]An array of DataGridViewRow objects to be added to the DataGridViewRowCollection.

Throws:

Instance member Clear()

Clears the collection.

Throws:

Instance member Contains(row)

Determines whether the specified DataGridViewRow is in the collection.

ParameterTypeDescription
rowDataGridViewRowThe DataGridViewRow to locate in the DataGridViewRowCollection.

Returns: Boolean. true if the DataGridViewRow is in the DataGridViewRowCollection; otherwise, false.

Instance member CopyTo(array, index)

Copies the items from the collection into the specified DataGridViewRow array, starting at the specified index.

ParameterTypeDescription
arrayDataGridViewRow[]A DataGridViewRow array that is the destination of the items copied from the DataGridViewRowCollection.
indexInt32The zero-based index in array at which copying begins.

Throws:

Instance member GetFirstRow(includeFilter, excludeFilter)

Returns the first DataGridViewRow that matches the specified includeFilter and excludeFilter .

ParameterTypeDescription
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The first DataGridViewRow that matches the specified filters; or null if no row is found.

Throws:

Instance member GetFirstRowIndex(includeFilter, excludeFilter)

Returns the index of the first DataGridViewRow that matches the specified includeFilter and excludeFilter .

ParameterTypeDescription
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of the first DataGridViewRow that matches the specified filters; or -1 if no row is found.

Throws:

Instance member GetLastRow(includeFilter, excludeFilter)

Returns the last DataGridViewRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The last DataGridViewRow that matches the specified filter; or null if no row is found.

Throws:

Instance member GetLastRowIndex(includeFilter, excludeFilter)

Returns the index of the last DataGridViewRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of the last DataGridViewRow that matches the specified filter; or -1 if no row is found.

Throws:

Instance member GetNextRow(startRow, includeFilter, excludeFilter)

Returns the next DataGridViewRow after startRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startRowDataGridViewRowThe row where the method should begin to look for the next DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The next DataGridViewRow that matches the filters; or null if no row is found after startRow .

Throws:

Instance member GetNextRow(startIndex, includeFilter, excludeFilter)

Returns the next DataGridViewRow after startIndex that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startIndexInt32The index of the row where the method should begin to look for the next DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The next DataGridViewRow that matches the filters; or null if no row is found after startIndex .

Throws:

Instance member GetNextRowIndex(startRow, includeFilter, excludeFilter)

Returns the index of the next DataGridViewRow after startRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startRowDataGridViewRowThe row where the method should begin to look for the next DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of the next DataGridViewRow that matches the filters; or -1 if no row is found after startRow .

Throws:

Instance member GetNextRowIndex(startIndex, includeFilter, excludeFilter)

Returns the index of the next DataGridViewRow after startIndex that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startIndexInt32The index of the row where the method should begin to look for the next DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of the next DataGridViewRow that matches the filters; or -1 if no row is found after startIndex .

Throws:

Instance member GetPreviousRow(startRow, includeFilter, excludeFilter)

Returns the previous DataGridViewRow before startRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startRowDataGridViewRowThe row where the method should begin to look for the previous DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The previous DataGridViewRow that matches the filters; or null if no row is found before startRow .

Throws:

Instance member GetPreviousRow(startIndex, includeFilter, excludeFilter)

Returns the previous DataGridViewRow before startIndex that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startIndexInt32The index of the row where the method should begin to look for the previous DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: DataGridViewRow. The previous DataGridViewRow that matches the filters; or null if no row is found before startIndex .

Throws:

Instance member GetPreviousRowIndex(startRow, includeFilter, excludeFilter)

Returns the index of the previous DataGridViewRow before startRow that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startRowDataGridViewRowThe row where the method should begin to look for the previous DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of previous DataGridViewRow that matches the filters; or -1 if no row is found before startRow .

Throws:

Instance member GetPreviousRowIndex(startIndex, includeFilter, excludeFilter)

Returns the index of the previous DataGridViewRow before startIndex that matches the includeFilter and excludeFilter .

ParameterTypeDescription
startIndexInt32The index of the row where the method should begin to look for the previous DataGridViewRow.
includeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.
excludeFilter optionalDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The index of the previous DataGridViewRow that matches the filters; or -1 if no row is found before startIndex .

Throws:

Instance member GetRowCount(includeFilter)

Returns the number of rows that match the includeFilter .

ParameterTypeDescription
includeFilterDataGridViewElementStatesA combination of the DataGridViewElementStates values for inclusion.

Returns: Int32. The number of rows that match the includeFilter .

Throws:

Instance member GetRowsHeight(includeFilter)

Returns the cumulative height of the DataGridViewRow objects that match the includeFilter .

ParameterTypeDescription
includeFilterDataGridViewElementStatesA bitwise combination of DataGridViewElementStates values.

Returns: Int32. The cumulative height of DataGridViewRow objects that match the includeFilter .

Throws:

Instance member GetRowState(rowIndex)

Returns the state of the DataGridViewRow at the specified index.

ParameterTypeDescription
rowIndexInt32The index of the row.

Returns: DataGridViewElementStates. A combination of DataGridViewElementStates values indicating the state of the row.

Throws:

Instance member IndexOf(row)

Returns the index of the given DataGridViewRow in the collection.

ParameterTypeDescription
rowDataGridViewRowThe DataGridViewRow to return the index of.

Returns: Int32. The index of the given DataGridViewRow.

Instance member Insert(index)

Inserts a DataGridViewRow into the collection at the specified position.

ParameterTypeDescription
indexInt32The position at which to insert the DataGridViewRow.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Or the VirtualMode property of the DataGridView is set to true.

Or the row returned by the RowTemplate property has more cells than there are columns in the control.

Instance member Insert(index, values)

Inserts a DataGridViewRow into the collection at the specified position, and populates the cells with the specified objects.

ParameterTypeDescription
indexInt32The position at which to insert the DataGridViewRow.
valuesObject[]A variable number of objects that populate the cells of the new DataGridViewRow.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Or the VirtualMode property of the DataGridView is set to true.

Or the row returned by the RowTemplate property has more cells than there are columns in the control.

Instance member Insert(index, row)

Inserts the specified DataGridViewRow into the collection.

ParameterTypeDescription
indexInt32The position at which to insert the row.
rowDataGridViewRowThe DataGridViewRow to insert into the DataGridViewRowCollection.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member Insert(index, count)

Inserts the specified number of rows into the collection at the specified location.

ParameterTypeDescription
indexInt32The position at which to insert the rows.
countInt32The number of rows to insert into the DataGridViewRowCollection.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member InsertCopies(indexSource, indexDestination, count)

Inserts rows into the collection at the specified position.

ParameterTypeDescription
indexSourceInt32The index of the DataGridViewRow on which to base the new rows.
indexDestinationInt32The position at which to insert the rows.
countInt32The number of DataGridViewRow objects to add to the DataGridViewRowCollection.

Throws:

Instance member InsertCopy(indexSource, indexDestination)

Inserts a new DataGridViewRow into the collection at the specified indexDestination , based on the DataGridViewRow at indexSource .

ParameterTypeDescription
indexSourceInt32The index of the DataGridViewRow on which to base the new DataGridViewRow.
indexDestinationInt32The position at which to insert the row.

Throws:

Instance member InsertRange(index, newRows)

Inserts the DataGridViewRow objects into the collection at the specified position.

ParameterTypeDescription
indexInt32The position at which to insert the rows.
newRowsDataGridViewRow[]An array of DataGridViewRow objects to add to the DataGridViewRowCollection.

Throws:

Protected member OnCollectionChanged(action, element, recreateNewRow)

Fires the CollectionChanged event.

ParameterTypeDescription
actionCollectionChangeActionOne of CollectionChangeAction indicating the reason the collection has changed.
elementObjectThe element that was added or removed from the collection, or null.
recreateNewRow optionalBooleanIndicates whether the grid should re-create the new automatic row.

Instance member Remove(row)

Removes the row from the collection.

ParameterTypeDescription
rowDataGridViewRowThe row to remove from the DataGridViewRowCollection.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Instance member RemoveAt(index)

Removes the DataGridViewRow at the specified position from the collection.

ParameterTypeDescription
indexInt32The position of the row to remove.

Throws:

Or the DataSource property of the DataGridView is not null.

Or the DataGridView has no columns.

Events

Instance member CollectionChanged

CollectionChangeEventHandler Fired when the collection changes.