rp
asked on
Duplicate a row
Hi,
When declare a datarow = datarow, when change value in one, the changes are reflected in other:
Dim row 1 As DataRow
Dim row2 As DataRow
row2=row1
row2("Id")=100
When put row2=row1and modify a column field the value is the same for row1 and row2. How can declare row2 to "clone" row 1, but when modify row2 only affects row2 and not row1?
best regards
When declare a datarow = datarow, when change value in one, the changes are reflected in other:
Dim row 1 As DataRow
Dim row2 As DataRow
row2=row1
row2("Id")=100
When put row2=row1and modify a column field the value is the same for row1 and row2. How can declare row2 to "clone" row 1, but when modify row2 only affects row2 and not row1?
best regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
row2.ItemArray = (object[])row1.ItemArray.C
Oops - not looked too closely at the previous comment. I'd just seen the foreach and thought it copied each field.