相关疑难解决方法(0)

使用LINQ获取DataGridView行索引,其中第一列具有特定值

我想得到DataGridViewRow的索引,其第一列的值匹配.

我的代码到目前为止:

string SearchForThis = "test";

int index = from r in dgv.Rows
            where r.Cells[0].Value == SearchForThis
            select r.Index;
Run Code Online (Sandbox Code Playgroud)

编译错误:

找不到源类型'System.Windows.Forms.DataGridViewRowCollection'的查询模式的实现.'哪里'找不到.考虑明确指定范围变量'r'的类型.

c# linq datagridview

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

datagridview ×1

linq ×1