DataRowChangeEventHandler Delegado

Definición

Representa el método que controlará los eventos RowChanging, RowChanged, RowDeleting y RowDeleted de DataTable.Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable.

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

Parámetros

sender
Object

Origen del evento.The source of the event.

e
DataRowChangeEventArgs

Valor DataRowChangeEventArgs que contiene los datos del evento.A DataRowChangeEventArgs that contains the event data.

Herencia
DataRowChangeEventHandler

Ejemplos

En el ejemplo siguiente se agrega una DataRowChangeEventHandler y el procedimiento para controlar el evento cuando se cambia una fila.The following example adds a DataRowChangeEventHandler and the procedure to handle the event when a row is changed. El procedimiento imprime la acción y el valor de la fila modificada.The procedure prints the action and value of the changed row.

private DataTable dataTable;

private void AddHandler(){
   dataTable = new DataTable("dataTable");
   dataTable.RowChanged +=
      new System.Data.DataRowChangeEventHandler(dataTable_Changed);
}

private void dataTable_Changed(object sender,
System.Data.DataRowChangeEventArgs e) 
{ 
   Console.WriteLine("Row Changed", e.Action,
      e.Row[dataGrid1.CurrentCell.ColumnNumber]);
}
Private dataTable As DataTable    
   
Private Sub [AddHandler]()
    dataTable = New DataTable("dataTable")
    AddHandler dataTable.RowChanged, AddressOf dataTable_Changed
End Sub    
   
Private Sub dataTable_Changed _
   (sender As Object, e As System.Data.DataRowChangeEventArgs)

    Console.WriteLine("Row Changed", e.Action, _
       e.Row(dataGrid1.CurrentCell.ColumnNumber))
End Sub

Comentarios

Cuando se crea un delegado DataRowChangeEventHandler, se identifica el método que controlará el evento.When you create a DataRowChangeEventHandler delegate, you identify the method that will handle the event. Para asociar el evento al controlador, se debe agregar una instancia del delegado al evento.To associate the event with your event handler, add an instance of the delegate to the event. Se llama al controlador de eventos cada vez que se produce el evento, hasta que se quite el delegado.The event handler is called whenever the event occurs, until you remove the delegate. Para obtener más información sobre los delegados, vea controlar y provocar eventos.For more information about delegates, see Handling and Raising Events.

Métodos de extensión

GetMethodInfo(Delegate)

Obtiene un objeto que representa el método representado por el delegado especificado.Gets an object that represents the method represented by the specified delegate.

Se aplica a

Consulte también: