I am trying to write a function as follows:
private void Func1(DataColumnChangeEventArgs e)
{
ds.TableName.AddRow(
e.Row[e.Column.ColumnName, DataRowVersion.Original].ToString(),
e.Row[e.Column.ColumnName, DataRowVersion.Proposed].ToString());
}
and I am calling it as:
private void Func2()
{
DataColumnChangeEventArgs e = new DataColumnChangeEventArgs(
dataTable.Rows[index],
dataTable.Columns["ColName"],
newValue);
e.ProposedValue = newValue;
Func1(e);
}
However, e.Row[e.Column.ColumnName, DataRowVersion.Proposed].ToString() is throwing a VersionNotFoundException. Is there any way to achieve this?
I would say, your method should look like this:
As there is no versions in that row in your row in args, but there is new and old values…