Jeanno
Jeanno

Reputation: 2859

How to handle dataTable.Rows.Clear() event in C#?

I cant figure out how to handle dataTable.Rows.Clear() event, it is not captured by both dataTable.RowDeleted nor by dataTable.RowChanged. I would like to capture the event AFTER all rows have been cleared from the table. Thanks

Upvotes: 0

Views: 205

Answers (1)

jimit patel
jimit patel

Reputation: 46

By the follow code snippet you can achieve the handling of the Rows.Clear() event.

Assign a handler to TableCleared

dt.TableCleared += dt_TableCleared;

void dt_TableCleared(object sender, DataTableClearEventArgs e)
{
    // your code
}

Hope this code will help you!

Upvotes: 1

Related Questions