This documentation is archived and is not being maintained.

DataGridViewRowsAddedEventHandler Delegate

Note: This delegate is new in the .NET Framework version 2.0.

Represents the method that will handle the RowsAdded event of a DataGridView.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

Public Delegate Sub DataGridViewRowsAddedEventHandler ( _
	sender As Object, _
	e As DataGridViewRowsAddedEventArgs _
Dim instance As New DataGridViewRowsAddedEventHandler(AddressOf HandlerMethod)
/** @delegate */
public delegate void DataGridViewRowsAddedEventHandler (
	Object sender, 
	DataGridViewRowsAddedEventArgs e
JScript supports the use of delegates, but not the declaration of new ones.



The source of the event.


A DataGridViewRowsAddedEventArgs that contains the event data.

The RowsAdded event occurs when rows are added to a DataGridView control.

When you create a DataGridViewRowsAddedEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.

The following code example uses a DataGridViewRowsAddedEventHandler in virtual mode to store the fact that a row has been added. This example is part of a larger example available in the VirtualMode reference topic.

Private Sub dataGridView1_RowsAdded(ByVal sender As Object, _
    ByVal e As DataGridViewRowsAddedEventArgs) _
    Handles dataGridView1.RowsAdded

    If newRowNeeded Then
        newRowNeeded = False
        numberOfRows = numberOfRows + 1
    End If
End Sub

private void dataGridView1_RowsAdded(Object sender,
    DataGridViewRowsAddedEventArgs e)
    if (newRowNeeded) {
        newRowNeeded = false;
        numberOfRows = numberOfRows + 1;
} //dataGridView1_RowsAdded

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0