我有一个
Dictionary<string, DataGridViewColumn> junctionTableDependencies = new Dictionary<string, DataGridViewColumn>();我想使用rows属性迭代字典的值,这些值是单元格的某个值的列,但我似乎没有它
foreach(DataGridViewColumn searchCol in junctionTableDependencies.Values)
foreach(DataGridViewRow row in **searchCol**.)
if(value==row.Cells[0].Value.ToString())在没有row.Cells的情况下,我如何垂直地遍历列?
发布于 2017-03-12 19:03:36
您有DataGridViewColumn,因此您需要找到它所属的DataGridView,然后枚举查找到的网格的行:
foreach(DataGridViewColumn searchCol in junctionTableDependencies.Values)
{
foreach(DataGridViewRow thisRow in searchCol.DataGridView.Rows)
{
var value = thisRow.Cells[searchCol.Name];
if (value == "whateverYouNeed")
{
// Code...
}
}
}https://stackoverflow.com/questions/42751117
复制相似问题