I use something similar on many of my forms. My version doesn’t have the >> buttons, only the > type buttons.
I use lists to handle what it currently in the two gridviews and a delimited string to store it on my record.
Bits of code from it:
private void btnRemove_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
try{System.Data.DataRow currentRow = opMastView.CurrentDataRow;
currentCourse = grdRequired.ActiveRow.Cells["Value"].Value.ToString();
if (RequiredCourses.Contains(currentCourse)) RequiredCourses.Remove(currentCourse);
try{currentRow["WorkInst_c"] = RequiredCourses.Aggregate((a,b) => a + "~" + b);}catch{currentRow["WorkInst_c"] = "";}
grdRequired.DataSource = RequiredCourses;
try{RequiredCourses.Remove("");}catch{}
try{grdRequired.DisplayLayout.Bands[0].Columns["Value"].Width = 229;}catch{}
}catch{}
Fill_grdAll();
}
private void btnAdd_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
try{System.Data.DataRow currentRow = opMastView.CurrentDataRow;
currentCourse = grdAll.ActiveRow.Cells["Value"].Value.ToString();
try{grdRequired.DisplayLayout.Bands[0].Columns["Value"].Width = 229;}catch{}
if (!RequiredCourses.Contains(currentCourse)) RequiredCourses.Add(currentCourse);
grdRequired.DataSource = RequiredCourses;
try{RequiredCourses.Remove("");}catch{}
try{grdRequired.DisplayLayout.Bands[0].Columns["Value"].Width = 229;}catch{}
try{currentRow["WorkInst_c"] = RequiredCourses.Aggregate((a,b) => a + "~" + b);}catch{currentRow["WorkInst_c"] = "";}
}catch{}
Fill_grdAll();
}
Probably not the most efficient way to do it, but it works for me and hopefully you can pull a few things from it to point you in the right direction.