从datagridview中显示的行搜索特定字符串时出现问题 [英] problem in searching a particular string from the rows displayed in datagridview

查看:138
本文介绍了从datagridview中显示的行搜索特定字符串时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



从datagridview中显示的行搜索特定字符串时出现问题.Datagridview包含类似"<"的数据br>第1行-00 C3 17 67
第2行-89 B4 56
第3行89 C3 17 89 78 45

但现在问题是用户是否输入"C3 17"。用于搜索的字符串结果应显示第1行和第3行
所以我使用以下代码但这不起作用,甚至我使用了string.Contains这也无效。

我的代码:

DataView
dv = new DataView datatable1 "[ 数据 ]" + " like'%" + TextBox1.Text.ToString()。Trim()+ "%'" "" DataViewRowState .CurrentRows);

Hi,

I have a problem while searching a particular string from the rows displayed in  datagridview.Datagridview contains data like "
1st row -00 C3 17 67
2nd row-89 B4 56
3rd row 89 C3 17 89 78 45

but now problem is if the user enters "C3 17" string  for search the results should display 1st and 3rd rows
So  I am using the following code but this does not work and even i used string.Contains this is also not working.

My Code:

 DataView
dv = new DataView(datatable1, "[Data]" + " like '% " + TextBox1.Text.ToString().Trim() + " %'", "", DataViewRowState.CurrentRows);

datatable2.Merge(dv.ToTable(), true < font size = 2>);

datatable2.Merge(dv.ToTable(), true);



请帮助找到解决方案。

谢谢
Kusuma



Pls help in finding the solution for this.

Thanks
Kusuma

推荐答案

在我看来, < font color ="#a31515">" [" 数据"]" 应该是" [Data]" " [" + Data + "]"
In my eyes the following "[" Data "]" should either be "[Data]" or "[" + Data + "]"


这篇关于从datagridview中显示的行搜索特定字符串时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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