桌面应用程序的搜索功能代码 [英] code for search funtion for a desktop application

查看:162
本文介绍了桌面应用程序的搜索功能代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我需要我正在开发的桌面应用程序的C#代码,我需要搜索功能的帮助.它必须仅按名称进行搜索.我一直在Google各处搜索,但一无所获.我不想为网页提供代码,只是桌面应用程序
在此先感谢

Hi all
I need c# code for a desktop application that i am developing,i need help for the search function.It must seearch by name only.I have been looking all over google but have found nothing.I dont want want code for a web page,itis simply a desktop application
Thanks in advance

推荐答案

使用搜索字符串进行过滤,
如果我在其中输入搜索字符串的文本框即(txtName)
& datagrid中的数据字段名称为dgName,然后

将字符串创建为"dgName like""+ trim(txtName.text)+"%"
然后使用Datagrid中的数据源创建一个数据视图
使用dataview.rowfilter命令&将创建的字符串传递给此
然后再次将相同的数据视图绑定到网格
use search string for filtering,
if I have text-box namely (txtName) where I am entering my search string
& datafield name in datagrid is dgName then

create string as " dgName like '' " + trim(txtName.text) + " %''"
then create a dataview with data source from Datagrid
use dataview.rowfilter command & pass created string to this
then again bind same dataview to grid


这篇关于桌面应用程序的搜索功能代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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