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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14298 |

    I have an application to allow our users to create their own custom sets of data. I have 2 xceed grid’s (version 3.0) on my form. The idea is to allow the user to select rows from grid 2 and add the data to grid 1. This part I do not have a problem with. However, we have a requirement that if the data exists in grid 1 do not allow the user to add the same thing from grid 2. Is there an easy way to determine whether or not the data is already present in grid 1 before I add it from grid 2? Any help would be appreciate.

    Thank you,

    Nathan

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

    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)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.