Saleh
Saleh

Reputation: 2719

DataSet - RowChanged Event raised many Times?

I have this code :

this.hRAddNewDataSet.Employee.RowChanged += new DataRowChangeEventHandler(Employee_RowChanged);

    void Employee_RowChanged(object sender, DataRowChangeEventArgs e)
    {
        test++;
        Trace.WriteLine(test.ToString());
    }

When I run my app and edit one row and then click the save button, the RowChanged event will fire 35 time!. I know this because of the value for test var.

My Questions:

  1. why this event fire like this?
  2. How I can get the current column is being updated?

Upvotes: 0

Views: 1085

Answers (1)

si618
si618

Reputation: 16858

why this event fire like this?

Perhaps you are wiring up the event handler multiple times?

Or maybe some part of your code is changing the row multiple times?

How I can get the current column is being updated?

Use the ColumnChanged event and check the DataColumnChangeEventArgs parameter.

Upvotes: 1

Related Questions