组合框搜索 [英] Combobox Search
问题描述
我在尝试进行自由文本搜索"时遇到了很多问题.组合框及其项目的功能.谁想让它正常工作.
仅适用于一个Combobox,我需要能够搜索:"uck"如果完整字符串为"Donald Duck",则所有带有字符串"uck"的结果它应该显示在组合框列表中.
Hi I am having enormous problems while trying to make a "Free Text search" function for a combobox and it's items. Whould love to get this to work.
It's For only one Combobox and i need to be able to search for: "uck" where the full string is "Donald Duck", all the results with the string "uck" in it should show up in the combobox list.
预先感谢.
推荐答案
Hi
您可能有一个For Each循环,可以对组合框项目"属性中包含的字符串进行迭代,并使用Contains方法来确定是否找到了匹配项.像...
You could have a For Each loop iterating through the strings contained in the Combo Boxes Items property and use the Contains methods to determine whether a match has been found. Something like...
用于 每个 项目 为 字符串 ComboBox1.Items |
如果 item.Contains(searchString) 然后 |
,MessageBox.Show( 找到了字符串" ) td> |
其他 |
MessageBox.Show( "未找到" ) |
结束 如果 |
下一个 |
For Each item As String In ComboBox1.Items |
If item.Contains(searchString) Then |
MessageBox.Show("Found the string") |
Else |
MessageBox.Show("Not found") |
End If |
Next |
这篇关于组合框搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!