Now I have
var row = container.Tables[name].NewRow();
row[0] = time;
row[1] = val;
container.Tables[name].Rows.Add(row);
Of course event DataTableNewRowEvent is fired in first line. But I need fire them after last line, I mean after adding new row to RowsCollection. How to make it? I need it to get actual data in DataTable at the moment of firing DataTableNewRowEvent
I think about:
//to insert proper data
var row = container.Tables[name].NewRow();
row[0] = time;
row[1] = val;
container.Tables[name].Rows.Add(row);
//to fire event
container.Tables[name].Rows.Remove(container.Tables[name].NewRow());
but probably it's not best solution.
I think you better handle the
RowChangedevent onDataTable, you'll get a parameter of typeDataRowChangeEventArgsthat has aDataRowActionproperty that let's you know the change that actually took place on the row,Addbeing one of the possible values.Your handler would look like this