This code used to work prior to version 2.2.
I found when adding a new row directly to a DGV it was not adding it to the bound data table so I had to programatically add the data to the table using the code below
if (Adding)
{
//Underlying datable does not contain new row so we have to add it
DataRow NR = dtTest.NewRow();
for (int j = 0; j < dgvTest.Columns.Count; j++)
{
NR[j] = dgvTest[j, e.RowIndex].Value;
}
dtTest.Rows.Add(NR); //Adds two rows to data table why?
dtTest.Rows[e.RowIndex +1].AcceptChanges();
dtTest.RejectChanges(); //removes duplicate – Fails here now – workaround to remove extra row if commented out two rows added
dtTest.Rows[bsTest.Position].SetAdded();
dm.Update(dtTest, “updEmps”, “”, 46);
}
Thanks for your help
You can’t code a DGV in the same way that was required for VWG!
Apologies for wasting your valuable time
Please login first to submit.