copy a value from one grid to another

larris

Member
Joined
Mar 13, 2006
Messages
23
Programming Experience
1-3
I have 2 datagrids witch both a populated with data.
The first grid has the last collumn set as unbound collumn.
How can i copy the value from the first collumn of grid 2 to the last unbound collumn of first grid?
 
This is just off the top of my head so i apologise if it doesn't work but.. Why dont you just create a new datacolumn object and make it a copy of the column in grid 2 and then add it to grid 1
 
forget what i said the datacolumn class only exposes a memberwise clone method, so thats no good. Well the other way wouldbe to use a for next loop to iterate through the datarow collection, then you can use the datarow.item property to get the info at the column index you want. Then just simply put that into the other datacolumn
 
That doesnt work either.I finally found the solution.I have created a new datatable with the datagrid collumns,populated it with the grid data and then add 2 more collumns with the calculated data i need.Then i rebind the datagrid to the table and it works just the way i need it
 
Back
Top