DataGridViewRowsRemovedEventArgs DataGridViewRowsRemovedEventArgs DataGridViewRowsRemovedEventArgs DataGridViewRowsRemovedEventArgs Class

Definition

Provides data for the RowsRemoved event.

public ref class DataGridViewRowsRemovedEventArgs : EventArgs
public class DataGridViewRowsRemovedEventArgs : EventArgs
type DataGridViewRowsRemovedEventArgs = class
    inherit EventArgs
Public Class DataGridViewRowsRemovedEventArgs
Inherits EventArgs
Inheritance
DataGridViewRowsRemovedEventArgsDataGridViewRowsRemovedEventArgsDataGridViewRowsRemovedEventArgsDataGridViewRowsRemovedEventArgs

Examples

The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the RowsRemoved event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type DataGridView named DataGridView1. Then ensure that the event handler is associated with the RowsRemoved event.

private void DataGridView1_RowsRemoved(Object sender, DataGridViewRowsRemovedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowCount", e.RowCount );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowsRemoved Event" );
}
Private Sub DataGridView1_RowsRemoved(sender as Object, e as DataGridViewRowsRemovedEventArgs) _ 
     Handles DataGridView1.RowsRemoved

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "RowCount", e.RowCount)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RowsRemoved Event")

End Sub

Remarks

When rows are deleted from a DataGridView control, the index numbers of subsequent rows are lowered to compensate.

For more information about how to handle events, see Handling and Raising Events.

Constructors

DataGridViewRowsRemovedEventArgs(Int32, Int32) DataGridViewRowsRemovedEventArgs(Int32, Int32) DataGridViewRowsRemovedEventArgs(Int32, Int32) DataGridViewRowsRemovedEventArgs(Int32, Int32)

Initializes a new instance of the DataGridViewRowsRemovedEventArgs class.

Properties

RowCount RowCount RowCount RowCount

Gets the number of rows that were deleted.

RowIndex RowIndex RowIndex RowIndex

Gets the zero-based index of the row deleted, or the first deleted row if multiple rows were deleted.

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also