如何在datagridview中查找数据(仅限特定列) [英] how to find data in datagridview (only a specific column)

查看:72
本文介绍了如何在datagridview中查找数据(仅限特定列)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有一个datagridview控件,它包含多个数据。我想搜索textbox.text数据可用或不可用于datagridview(只有一个特定的列)控件..如果数据可用那么那些cellbackcolor得到chenged.in windows应用程序...



提前谢谢

hello everyone i have a datagridview control and it''s contain multiple data.and i want to search textbox.text data is available or not available in datagridview (only a specific column) control ..if data is available then those cellbackcolor get chenged.in windows application...

Thanks in advance

推荐答案

也许它应该工作:

Maybe it should work :
int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows) 
   {
     if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
        //Do Something
        intcount += 1;
    }
}


我自己解决.....



I solve my self.....

int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows)
   {
     if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
        dataGridView1.Rows[intcount].Cells[0].Style.BackColor=Color.White;
        intcount += 1;
    }
}


这篇关于如何在datagridview中查找数据(仅限特定列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆