private void OnRowChanged(object sender, DataRowChangeEventArgs e) { Console.WriteLine("Row changed: " + e.Row["FieldName"] + " " + e.Action); }
private void OnTableChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) { if (e.Action == System.ComponentModel.CollectionChangeAction.Add) { // Cast the new item as DataRowView and get its DataRow. DataRow newRow = ((DataRowView)e.Element).Row; Console.WriteLine("New row added: " + newRow[0]); } }In this example, DataRowChangeEventArgs is used in handling events when a new row is added to a DataTable. It extracts the new row using the DataRowView and prints the value of its first column. Package/Library: System.Data.SqlClient.