PDA

Click to See Complete Forum and Search --> : Problem with Datarow Objects


Duncanm
Oct 10th, 2002, 12:46 PM
I know this is probably a very easy solution , but I can't find anything anywhere. Basically what I am trying to do is make a copy of a datarow , and delete the current one (for a kind of cut/paste routine). This is my current code :

'create new dataview
Dim dvTemp As New DataView(dsReports.Tables(0))

'create filtered view
dvTemp.RowFilter = "Rowid = " & CStr(RowID)

'get first item in view (filter willl only return 1 item) and copy to clipboard datarow

drRowClipBoard = dvTemp.Item(0).Row

dvTemp.Item(0).Row.Delete()

what is happening is when I call the delete() procedure on the datarow , it will delete the datarow that im storing in the drRowClipBoard object as well , I'm assuming because it is just a reference to the other row and not a copy , how do I make a copy?

Hopefully this makes some sense.

Slow_Learner
Oct 10th, 2002, 05:30 PM
Looks like the .MemberwiseClone method is what you're looking for:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemobjectclassmemberwiseclonetopic.htm

kunze
Nov 22nd, 2005, 03:11 AM
i had the same problem and i found this page

http://www.firelightsoftware.com/CopyPasteDataset.aspx

sounds logical ... or???

... you can only copy seriazible objects to clipboard... so put the rows in a dataset and copy the dataset to clipboard