C# 从DataGridViewRowCollection c添加行#

C# 从DataGridViewRowCollection c添加行#,c#,winforms,datagridview,C#,Winforms,Datagridview,所以,我有个问题。 我想通过使用List包装所有内容来动态更改DataGridViewRow。这里有一些片段 public List colTrx=new List(); //通过使用colTrx作为列表,我可以添加一些行集合 公共int pointerGrid=0; public void createDatas() { 如果(gridTab.Rows.Count!=0) { 添加(someGrid.Rows); 点数+=1; } } public void getData() { if(s

所以,我有个问题。
我想通过使用
List
包装所有内容来动态更改
DataGridViewRow
。这里有一些片段

public List colTrx=new List();
//通过使用colTrx作为列表,我可以添加一些行集合
公共int pointerGrid=0;
public void createDatas()
{
如果(gridTab.Rows.Count!=0)
{
添加(someGrid.Rows);
点数+=1;
}
}
public void getData()
{
if(someGrid.Rows.Count!=0)
{
someGrid.Rows.Clear();
}
其他的
{
DataGridViewRowCollection ollColl=colTrx[pointerGrid-1];
foreach(ollColl.Cast()中的DataGridViewRow kkk)
{
someGrid.Add(kkk);
}
//此处出现问题,无法从DataGridViewRowCollection添加行
点网格-=1;
}
}
目标是:

1.通过将一些行从
someGrid
添加到
colTrx

2.从
someGrid

3.当用户触发按钮时,从
colTrx[pointerGrid-1]
获取数据,
4.并从中设置行





如何实现这一点?

DataGridRowCollection已经是一个集合。您正在生成集合的列表。也许你想要一份清单,而不是当然!。但是,每一个收藏都是不同的。所以我列出了不同的行集:)你们能提供更多信息吗?比如说如果它给了你一个错误或什么?到目前为止还没有错误。但是,如果我直接添加,让我们说
someGrid.add(colTrx)
如果没有
DataGridViewRow
循环,它将返回包含
System.Collections.Generic
等内容的单行