I am binding a selected row to a new data row which needs to be added to a database.
I am using the dt.Importrow(newRow) to add the new datarow to the data table.
However, if I make changes to this new row, it also changes the selected row.
code below
''' Dim original_Row As DataRow
Dim newRow As DataRow = dt.NewRow
original_Row = CType(DataTbale.CurrentRow.DataBoundItem, DataRowView).Row
newRow = original_Row
newRow("Name") = John 'Changing value to new row here
dt.ImportRow(newRow)'''
I think that what you actually want to do is create a new row for a
DataTable, copy data from the currently selected row, modify that data, then add the row to the table.Firstly, you should be binding your
DataTablevia aBindingSourceand getting the selection from that: