c# - 从 DataGridViewRowCollection c# 添加行
问题描述
所以,我有一个问题。
我想DataGridViewRow
通过使用来动态更改通过包装它的所有内容List<DataGridViewRowCollection>
。这是一些片段
public List<DataGridViewRowCollection> colTrx = new List<DataGridViewRowCollection>();
// By using colTrx As List, I can add some row collections by added into it
public int pointerGrid = 0;
public void createDatas()
{
if(gridTab.Rows.Count != 0)
{
colTrx.add(someGrid.Rows);
point += 1;
}
}
public void getData()
{
if(someGrid.Rows.Count != 0)
{
someGrid.Rows.Clear();
}
else
{
DataGridViewRowCollection ollColl = colTrx[pointerGrid - 1];
foreach (DataGridViewRow kkk in ollColl.Cast<DataGridViewRow>())
{
someGrid.Add(kkk);
}
//Something wrong here, it won't add row from DataGridViewRowCollection
pointerGrid -= 1;
}
}
目标是:
1. 通过将一些行添加someGrid
到colTrx
2. 清除行someGrid
3. 当用户触发按钮时,从 4. 获取数据colTrx[pointerGrid - 1]
并
设置行
我怎样才能做到这一点?
解决方案
推荐阅读
- image - 无法加载资产:资产/在 Material 子项中
- jquery - 回发后丢失 Bootstrap CSS
- jquery - Moodle 3.5 Ajax 返回纯文本与 JSON
- reactjs - TypeError: Object(...) is not a function React
- python - Python:将目录 c:\FLASH 的内容复制到所有连接的 USB 闪存驱动器
- web-crawler - 抓取时,我无法转到特定页面
- python - 使用 matplotlib 进行 3D 绘图的两个 Z 轴
- sql - 保证随机插入
- php - Doctrine DQL WHERE with CASE?
- sql - Oracle DB 中的正则表达式