如何在数据网格视图中过滤记录并在数据网格中显示所选记录 [英] How to filter records in datagrid view and show the selected record in the datagrid

查看:29
本文介绍了如何在数据网格视图中过滤记录并在数据网格中显示所选记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请我有一个带有事务绑定源的数据网格视图,当我在文本框中输入一个值并单击按钮排序时,我希望数据网格仅显示已排序的行而不是所有记录.谢谢

Please I have a datagridview with transaction bindingsource I want the datagrid to show the sorted rows only not all the records when i enter a value into a textbox and click button sort. thanks

推荐答案

你必须把这样的代码放在你的控件中:

You have to put code like this in your control :

 YourGridViewBindingSource.Filter = String.Format("YourDBColumn Like ;'*" & FilterValue) & "*'"

例如,您可以将代码用作 TextBox.textchanged 控件,以便在您在 TextBox 中键入内容时过滤 Datagrid 视图

for example you can use the code as your TextBox.textchanged control to filter the Datagrid view as you type in the TextBox

这篇关于如何在数据网格视图中过滤记录并在数据网格中显示所选记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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