本文介绍了如何在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
推荐答案
int intcount = 0;
foreach (DataGridViewRow Row in DataGridView1.Rows)
{
if (DataGridView1.Rows(intcount).Cells(0).Value == "StringSearch") {
//Do Something
intcount += 1;
}
}
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中查找数据(仅限特定列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!