Is it possible to merge 2 seperate DataGridView
in C# into one? I am using a two seperate SortableBindingList
for each DataGridView
.
Here is the code for the first DataGridView called theChipDGV
.
theChipList.Add(new Chip(splitLine[0], splitLine[1], xValue, yValue, rotation, splitLine[5]));
theChipDGV.DataSource = theChipList;
Here is the code for the second DataGridView called theDataBaseDGV
.
theDataBaseList.Add(new DataBase(dataBaseSplit[0], dataBaseSplit[1], dataBaseSplit[2], dataBaseSplit[3], dataBaseSplit[4], dataBaseSplit[5], dataBaseSplit[6], 0));
theDataBaseDGV.DataSource = theDataBaseList;
EDIT:
theFinalList.Add(new Final(splitLine[0], splitLine[1], xValue, yValue, rotation, splitLine[5], dataBaseSplit[0], dataBaseSplit[1],
dataBaseSplit[2], dataBaseSplit[3], dataBaseSplit[4],dataBaseSplit[5], dataBaseSplit[6], 0));
OR
theFinalDGV.DataSource = theChipList + theDataBaseList;
OR
some other way since both of these I do not think will work?
If so, how is this possible?
EDIT2:
theLoadList.Add(new LoadLine(theChipList[0].Name, theChipList[0].PartNumber,
theChipList[0].XPlacement, theChipList[0].YPlacement, theChipList[0].Rotation,
theChipList[0].PkgStyle, theDataBaseList[0].PackageType, theDataBaseList[0].PartDescription,
theDataBaseList[0].Feeder, theDataBaseList[0].Vision, theDataBaseList[0].Speed,
theDataBaseList[0].Machine, theDataBaseList[0].TapeWidth, 0));
However using this only grabs one row and I need to grab every row.. Even if one list is larger than the other I would like to fill in the blank spots..
I tried messing with this:
int chipRowCount = theChipDGV.Rows.Count;
int dataBaseRowCount = theDataBaseDGV.Rows.Count;
int greaterValue = 0;
if (chipRowCount > dataBaseRowCount)
greaterValue = chipRowCount;
else
greaterValue = dataBaseRowCount;
int i = 1;
while (i < greaterValue)
{
// Place the above **EDIT2** code here. (theLoadList.Add(new LoadLine(...));
}