Szerkesztés

Megosztás a következőn keresztül:


DataGridViewRowsAddedEventHandler Delegate

Definition

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

public delegate void DataGridViewRowsAddedEventHandler(System::Object ^ sender, DataGridViewRowsAddedEventArgs ^ e);
public delegate void DataGridViewRowsAddedEventHandler(object sender, DataGridViewRowsAddedEventArgs e);
public delegate void DataGridViewRowsAddedEventHandler(object? sender, DataGridViewRowsAddedEventArgs e);
type DataGridViewRowsAddedEventHandler = delegate of obj * DataGridViewRowsAddedEventArgs -> unit
Public Delegate Sub DataGridViewRowsAddedEventHandler(sender As Object, e As DataGridViewRowsAddedEventArgs)

Parameters

sender
Object

The source of the event.

Examples

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.

void VirtualConnector::dataGridView1_RowsAdded
    (Object^ sender, DataGridViewRowsAddedEventArgs^ e)
{
    if (newRowNeeded)
    {
        newRowNeeded = false;
        numberOfRows = numberOfRows + 1;
    }
}
private void dataGridView1_RowsAdded(object sender,
     DataGridViewRowsAddedEventArgs e)
{
    if (newRowNeeded)
    {
        newRowNeeded = false;
        numberOfRows = numberOfRows + 1;
    }
}
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

Remarks

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 Handling and Raising Events.

Extension Methods

GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to

See also