This documentation is archived and is not being maintained.

DataRowChangeEventHandler Delegate

Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable.

[Visual Basic]
Public Delegate Sub DataRowChangeEventHandler( _
   ByVal sender As Object, _
   ByVal e As DataRowChangeEventArgs _
public delegate void DataRowChangeEventHandler(
   object sender,
   DataRowChangeEventArgs e
public __gc __delegate void DataRowChangeEventHandler(
   Object* sender,
   DataRowChangeEventArgs* e

[JScript] In JScript, you can use the delegates in the .NET Framework, but you cannot define your own.

Parameters [Visual Basic, C#, C++]

The declaration of your event handler must have the same parameters as the DataRowChangeEventHandler delegate declaration.

The source of the event.
A DataRowChangeEventArgs that contains the event data.


When you create a DataRowChangeEventHandler 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, until you remove the delegate. For more information about delegates, see Events and Delegates.


[Visual Basic, C#, C++] The following example adds a DataRowChangeEventHandler and the procedure to handle the event when a row is changed. The procedure prints the action and value of the changed row.

[Visual Basic] 
Private myDataTable As DataTable    
Private Sub [AddHandler]()
    myDataTable = New DataTable("myDataTable")
    AddHandler myDataTable.RowChanged, AddressOf myDataTable_Changed
End Sub    
Protected Sub myDataTable_Changed _
(sender As Object, e As System.Data.DataRowChangeEventArgs)

    Console.WriteLine("Row Changed", e.Action, _
End Sub

private DataTable myDataTable;

private void AddHandler(){
   myDataTable = new DataTable("myDataTable");
   myDataTable.RowChanged +=
      new System.Data.DataRowChangeEventHandler(myDataTable_Changed);

protected void myDataTable_Changed(object sender,
System.Data.DataRowChangeEventArgs e) { 
   Console.WriteLine("Row Changed", e.Action,

 DataTable* myDataTable;
 void AddHandler(){
    myDataTable = new DataTable(S"myDataTable");
    myDataTable->RowChanged +=
       new System::Data::DataRowChangeEventHandler(this, &Form1::myDataTable_Changed);
 void myDataTable_Changed(Object* /*sender*/, DataRowChangeEventArgs* e) { 
    Console::WriteLine(S"Row Changed", __box(e->Action),

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Data

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System.Data (in System.Data.dll)

See Also

System.Data Namespace | DataRow | DataTable | DataRowChangeEventArgs