Возможно ли объединить 2 отдельных DataGridView
в C # в один? Я использую два отдельных SortableBindingList
для каждого DataGridView
.
Вот код для первого DataGridView с именем theChipDGV
.
theChipList.Add(new Chip(splitLine[0], splitLine[1], xValue, yValue, rotation, splitLine[5]));
theChipDGV.DataSource = theChipList;
Вот код для второго DataGridView, который называется 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
как-то иначе, так как оба из них, я не думаю, будут работать?
Если так, как это возможно?
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));
Однако, используя это, можно получить только одну строку, и мне нужно захватить каждую строку. Даже если один список больше другого, я бы хотел заполнить пустые места ..
Я пытался возиться с этим:
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(...));
}