在文本框或组合框上搜索任何单词 [英] Any word search on textbox or combobox

查看:96
本文介绍了在文本框或组合框上搜索任何单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的发票应用程序,在这里我需要一个Item的搜索选项,在这里我使用了组合框,当我键入"a"时,它会产生默认属性"apple".但是在键入"p"时我需要"apple"或"l"以任何方式执行此操作.请帮助我..

I have a simple invoice application where I need an search option for Item there I have used combobox where when I type "a" It results "apple" which is an default property.But I need "apple" when typing "p" or "l" any ways to do that. Please help me..

推荐答案

实现这一目标的方法很少.
字符串.包含方法 [如何:在字符串中搜索(Visual Basic) [
There is few ways to achieve that.
String.Contains Method[^]
How to: Search Within a String (Visual Basic)[^]

Depending on your needs, you can use special characters, like: *; ?, etc.
If you want to find a in entire string, use:
result = stringVariable Like "*a*"


如果要在字符串末尾找到a,请使用:


If you want to find a at the end of string, use:

result = stringVariable Like "*a"


如果要在字符串的开头找到a,请使用:


If you want to find a at the beginning of string, use:

result = stringVariable Like "a*"



请参阅:
类似运算符(Visual Basic) [如何:将字符串与模式匹配(Visual Basic) [正则表达式 [将通配符转换为正则表达式 [



Please, see:
Like Operator (Visual Basic)[^]
How to: Match a String against a Pattern (Visual Basic)[^]


You can use Regex[^] too.
Converting Wildcards to Regexes[^]


这篇关于在文本框或组合框上搜索任何单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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