Home Forums WinForms controls Xceed Grid for WinForms copy data between 2 grid controls Reply To: copy data between 2 grid controls

User (Old forums)
Member
Post count: 23064

I got it working by doing this:

<code>
foreach (Xceed.Grid.DataRow r2 in gcLibId.SelectedRows)
{
foreach (Xceed.Grid.DataRow r1 in gcChroSet.DataRows)
{
if (r1.Cells[“COMP_ID”].Value.ToString() == r2.Cells[“COMP_ID”].Value.ToString())
{
blnExists = true;
}
else
{
blnExists = false;
}
}

if (!blnExists)
{
// add to gcChroSet grid
Xceed.Grid.DataRow row = gcChroSet.DataRows.AddNew();
row.Cells[“COMP_ID”].Value = (long)Convert.ToInt64(r2.Cells[“COMP_ID”].Value);
row.Cells[“LIBRARY_NAME”].Value = r2.Cells[“LIBRARY_NAME”].Value;
row.Cells[“REPORTED_NAME”].Value = r2.Cells[“REPORTED_NAME”].Value;
row.Cells[“STATUS”].Value = “”;
row.EndEdit();
}
}
</code>

Imported from legacy forums. Posted by Nathan (had 3028 views)