如何在文本框中插入文本后在Datagridview中搜索行,在组合框中选择项目 [英] How to search a row in a Datagridview after inserting text in textbox,selecting item in combobox
本文介绍了如何在文本框中插入文本后在Datagridview中搜索行,在组合框中选择项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hai
这是Tarun。
我是否知道如何搜索在文本框中插入文本后的Datagridview和
在组合框中选择一个项目。
Hai
This is Tarun.
May I Know how to search a row in a Datagridview after inserting text in textbox and
selecting a item in combobox.
推荐答案
你需要的只是突出显示应用条件的行或过滤你的网格 - 我的意思是只留下那些适用条件的行?
如果第二 - 它实际上取决于在数据网格的源上。
如果它是一些DataSet对象 - 你可以使用它的FilterExpression属性并将它设置为一些类似SQL的表达式来过滤结果集。
例如:
myDataSet.FilterExpression =Column1 LIKE'%'+ searchTextBox.Text +%';
Do you need just to highlight the row which apply the conditions or to filter your grid - I mean to leave only those rows in it that apply the conditions?
If second - it actually depends on the source of your data grid.
If it's some DataSet object - you can use its FilterExpression property and set it to some SQL-like expression which filter the result set.
Example:
myDataSet.FilterExpression = "Column1 LIKE '%' + searchTextBox.Text + "%'";
这篇关于如何在文本框中插入文本后在Datagridview中搜索行,在组合框中选择项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文