DataGridViewRowCollection
Wisej.Web.DataGridViewRowCollection
Last updated
Wisej.Web.DataGridViewRowCollection
Last updated
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.5.0.0)
A collection of DataGridViewRow objects.
Initializes a new instance of the DataGridViewRowCollection class for the given DataGridView.
Name | Type | Description |
---|---|---|
dataGrid | The DataGridView that created this collection. |
Int32: Returns the number of rows in the collection.
DataGridViewRow: Returns the DataGridViewRow at the specified index.
Throws:
ArgumentOutOfRangeException index is less than 0.- or - index is equal to or greater than Count.
Adds a new DataGridViewRow to the collection.
Returns: Int32. The index of the new DataGridViewRow.
Throws:
ArgumentException The row returned by the RowTemplate property has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Adds a new DataGridViewRow to the collection, and populates the cells with the specified objects.
Parameter | Type | Description |
---|---|---|
values | A variable number of objects that populate the cells of the new DataGridViewRow. |
Returns: Int32. The index of the new DataGridViewRow.
Throws:
ArgumentNullException values is null.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating 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.
Adds the specified DataGridViewRow to the collection.
Parameter | Type | Description |
---|---|---|
row | The DataGridViewRow to add to the DataGridViewRowCollection. |
Returns: Int32. The index of the new DataGridViewRow.
Throws:
ArgumentNullException row is null.
ArgumentException row has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Adds the specified number of new rows to the collection.
Parameter | Type | Description |
---|---|---|
count | The number of rows to add to the DataGridViewRowCollection. |
Returns: Int32. The index of the last row that was added.
Throws:
ArgumentOutOfRangeException count is less than 1.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Adds the specified number of rows to the collection based on the row at the specified index.
Parameter | Type | Description |
---|---|---|
rowIndex | The index of the row on which to base the new rows. | |
count | The number of rows to add to the DataGridViewRowCollection. |
Returns: Int32. The index of the last row that was added.
Throws:
ArgumentOutOfRangeException rowIndex is less than zero or greater than or equal to the number of rows in the control; or count is less than zero.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Adds a DataGridViewRow row based on the DataGridViewRow at the specified index.
Parameter | Type | Description |
---|---|---|
rowIndex | The index of the row on which to base the new row. |
Returns: Int32. The index of the new DataGridViewRow.
Throws:
ArgumentOutOfRangeException rowIndex is less than zero or greater than or equal to the number of rows in the collection.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Adds the specified DataGridViewRow objects to the collection.
Parameter | Type | Description |
---|---|---|
newRows | An array of DataGridViewRow objects to be added to the DataGridViewRowCollection. |
Throws:
ArgumentNullException newRows is null.
ArgumentException newRows contains only one row, and the row it contains has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Clears the collection.
Throws:
InvalidOperationException The collection is data bound and the underlying data source does not support clearing the row data. Or the associated DataGridView control is performing one of the following actions that temporarily prevents the row collection from being modified: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating
Determines whether the specified DataGridViewRow is in the collection.
Parameter | Type | Description |
---|---|---|
row | The DataGridViewRow to locate in the DataGridViewRowCollection. |
Returns: Boolean. true if the DataGridViewRow is in the DataGridViewRowCollection; otherwise, false.
Copies the items from the collection into the specified DataGridViewRow array, starting at the specified index.
Parameter | Type | Description |
---|---|---|
array | A DataGridViewRow array that is the destination of the items copied from the DataGridViewRowCollection. | |
index | The zero-based index in array at which copying begins. |
Throws:
ArgumentNullException array is null.
ArgumentOutOfRangeException index is less than zero.
ArgumentException array is multidimensional; or the number of elements in the DataGridViewRowCollection is greater than the available space from index to the end of array .
Returns the first DataGridViewRow that matches the specified includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The first DataGridViewRow that matches the specified filters; or null if no row is found.
Throws:
ArgumentException One or both of the specified filter values is not a valid combination of DataGridViewElementStates values.
Returns the index of the first DataGridViewRow that matches the specified includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentException One or both of the specified filter values is not a valid combination of DataGridViewElementStates values.
Returns the last DataGridViewRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The last DataGridViewRow that matches the specified filter; or null if no row is found.
Throws:
ArgumentException includeFilter is not a valid bitwise combination of DataGridViewElementStates values.
Returns the index of the last DataGridViewRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentException includeFilter is not a valid bitwise combination of DataGridViewElementStates values.
Returns the next DataGridViewRow after startRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startRow | The row where the method should begin to look for the next DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The next DataGridViewRow that matches the filters; or null if no row is found after startRow .
Throws:
ArgumentNullException startRow is null.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the next DataGridViewRow after startIndex that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startIndex | The index of the row where the method should begin to look for the next DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The next DataGridViewRow that matches the filters; or null if no row is found after startIndex .
Throws:
ArgumentOutOfRangeException startIndex is less than -1.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the index of the next DataGridViewRow after startRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startRow | The row where the method should begin to look for the next DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentNullException startRow is null.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the index of the next DataGridViewRow after startIndex that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startIndex | The index of the row where the method should begin to look for the next DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentOutOfRangeException startIndex is less than -1.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the previous DataGridViewRow before startRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startRow | The row where the method should begin to look for the previous DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The previous DataGridViewRow that matches the filters; or null if no row is found before startRow .
Throws:
ArgumentNullException startRow is null.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the previous DataGridViewRow before startIndex that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startIndex | The index of the row where the method should begin to look for the previous DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A bitwise combination of DataGridViewElementStates values. |
Returns: DataGridViewRow. The previous DataGridViewRow that matches the filters; or null if no row is found before startIndex .
Throws:
ArgumentOutOfRangeException startIndex is greater than the number of rows in the collection.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the index of the previous DataGridViewRow before startRow that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startRow | The row where the method should begin to look for the previous DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentNullException startRow is null.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the index of the previous DataGridViewRow before startIndex that matches the includeFilter and excludeFilter .
Parameter | Type | Description |
---|---|---|
startIndex | The index of the row where the method should begin to look for the previous DataGridViewRow. | |
A bitwise combination of DataGridViewElementStates values. | ||
A 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:
ArgumentOutOfRangeException startIndex is greater than the number of rows in the collection.
ArgumentException One or both of the specified filter values is not a valid bitwise combination of DataGridViewElementStates values.
Returns the number of rows that match the includeFilter .
Parameter | Type | Description |
---|---|---|
includeFilter | A combination of the DataGridViewElementStates values for inclusion. |
Returns: Int32. The number of rows that match the includeFilter .
Throws:
ArgumentException includeFilter is not a valid bitwise combination of DataGridViewElementStates values.
Returns the cumulative height of the DataGridViewRow objects that match the includeFilter .
Parameter | Type | Description |
---|---|---|
includeFilter | A bitwise combination of DataGridViewElementStates values. |
Returns: Int32. The cumulative height of DataGridViewRow objects that match the includeFilter .
Throws:
ArgumentException includeFilter is not a valid bitwise combination of DataGridViewElementStates values.
Returns the state of the DataGridViewRow at the specified index.
Parameter | Type | Description |
---|---|---|
rowIndex | The index of the row. |
Returns: DataGridViewElementStates. A combination of DataGridViewElementStates values indicating the state of the row.
Throws:
ArgumentOutOfRangeException rowIndex is less than zero and greater than the number of rows in the collection.
Returns the index of the given DataGridViewRow in the collection.
Parameter | Type | Description |
---|---|---|
row | The DataGridViewRow to return the index of. |
Returns: Int32. The index of the given DataGridViewRow.
Inserts a DataGridViewRow into the collection at the specified position.
Parameter | Type | Description |
---|---|---|
index | The position at which to insert the DataGridViewRow. |
Throws:
ArgumentOutOfRangeException index is less than zero or greater than the number of rows in the collection.
ArgumentException The row returned by the control's RowTemplate property has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating 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.
Inserts a DataGridViewRow into the collection at the specified position, and populates the cells with the specified objects.
Parameter | Type | Description |
---|---|---|
index | The position at which to insert the DataGridViewRow. | |
values | A variable number of objects that populate the cells of the new DataGridViewRow. |
Throws:
ArgumentOutOfRangeException index is less than zero or greater than the number of rows in the collection.
ArgumentNullException values is null.
ArgumentException The row returned by the control's RowTemplate property has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating 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.
Inserts the specified DataGridViewRow into the collection.
Parameter | Type | Description |
---|---|---|
index | The position at which to insert the row. | |
row | The DataGridViewRow to insert into the DataGridViewRowCollection. |
Throws:
ArgumentOutOfRangeException index is less than zero or greater than the number of rows in the collection.
ArgumentNullException row is null.
ArgumentException row has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Inserts the specified number of rows into the collection at the specified location.
Parameter | Type | Description |
---|---|---|
index | The position at which to insert the rows. | |
count | The number of rows to insert into the DataGridViewRowCollection. |
Throws:
ArgumentOutOfRangeException index is less than zero or greater than the number of rows in the collection. or count is less than 1.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Inserts rows into the collection at the specified position.
Parameter | Type | Description |
---|---|---|
indexSource | The index of the DataGridViewRow on which to base the new rows. | |
indexDestination | The position at which to insert the rows. | |
count | The number of DataGridViewRow objects to add to the DataGridViewRowCollection. |
Throws:
ArgumentOutOfRangeException indexSource is less than zero or greater than the number of rows in the collection minus one; or indexDestination is less than zero or greater than the number of rows in the collection; or count is less than 1.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Inserts a new DataGridViewRow into the collection at the specified indexDestination , based on the DataGridViewRow at indexSource .
Parameter | Type | Description |
---|---|---|
indexSource | The index of the DataGridViewRow on which to base the new DataGridViewRow. | |
indexDestination | The position at which to insert the row. |
Throws:
ArgumentOutOfRangeException indexSource is less than zero or greater than the number of rows in the collection minus one; or indexDestination is less than zero or greater than the number of rows in the collection.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Inserts the DataGridViewRow objects into the collection at the specified position.
Parameter | Type | Description |
---|---|---|
index | The position at which to insert the rows. | |
newRows | An array of DataGridViewRow objects to add to the DataGridViewRowCollection. |
Throws:
ArgumentNullException newRows is null.
ArgumentOutOfRangeException index is less than zero or greater than the number of rows in the collection.
ArgumentException newRows contains only one row, and the row it contains has more cells than there are columns in the control.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null.
Removes the row from the collection.
Parameter | Type | Description |
---|---|---|
row | The row to remove from the DataGridViewRowCollection. |
Throws:
ArgumentNullException row is null.
ArgumentException row is not contained in this collection; or row is a shared row.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
Removes the DataGridViewRow at the specified position from the collection.
Parameter | Type | Description |
---|---|---|
index | The position of the row to remove. |
Throws:
ArgumentOutOfRangeException index is less than zero and greater than the number of rows in the collection minus one.
InvalidOperationException The associated DataGridView control is performing one of the following actions that temporarily prevents new rows from being added: - Selecting all cells in the control. - Clearing the selection. Or this method is being called from a handler for one of the following DataGridView events: - CellEnter - CellLeave - CellValidating - CellValidated - RowEnter - RowLeave - RowValidated - RowValidating Or the DataSource property of the DataGridView is not null. Or the DataGridView has no columns.
CollectionChangeEventHandler Fired when the collection changes.
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter
includeFilter
excludeFilter