c# - 如何比较两个DatagridView的两列
问题描述
我有 2DatagridView
并且我有相同的列datagridView1
,dataGridView2
现在我想比较1 和 2Column [ID]
中的每一行datagridView
,如果ID
存在于 2 列中,Column["Names"]
传递到.["Age"]
datagridView2
dataGridView1
这只是我有,但它没有显示。
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
for (int a = 0; a < dataGridView2.Rows.Count; a++)
{
if (dataGridView1.Rows[i].Cells[0].Value == dataGridView2.Rows[i].Cells[0].Value)
{
dataGridView1.Rows[i].Cells[2].Value = dataGridView2.Rows[a].Cells[2].Value.ToString();
dataGridView1.Rows[i].Cells[3].Value = dataGridView2.Rows[a].Cells[3].Value.ToString();
i++;
a++;
}
}
}
解决方案
推荐阅读
- javascript - 不同数量的键盘快捷键挂钩
- javascript - 如何将布尔类型图标更改为相反
- javascript - 如何消除此错误 NgFor 仅支持绑定到 Iterables,例如 Arrays
- jquery - 如何在 NodeJs 中使用 Express 在 jsGrid 中设置数据
- vba - 如何在excel VBA中查找活动单元格范围
- javascript - “愚蠢的表格”插件:如何不向后排序表格?
- mongodb - 如何检查对象在 MongoDB 的其他文档中
- python - 子进程不写输出文件
- symfony - 是否可以在 JMS 中创建组依赖项
- node.js - API-Gateway 背后的 Socket.io