问题描述
我搜索了如何在 winform TextBox 中使用自动完成[包含而不是开头],但显然没有我想要的结果。
所以我在这里尝试这个代码,没有错误,但它不会出现。我错过了什么吗?
Private Sub txtSelection_TextChanged(sender As Object,e As EventArgs) Handles txtSelection.TextChanged
Dim suggestions As New AutoCompleteStringCollection()
Dim str As String = txtSelection.Text
... 'get dtselection from MysqL'
For i As Integer = 0 To dtSelection.Rows.Count - 1
If dtSelection.Rows(i).Item(1).ToString().ToLower.Contains(str.ToLower) Then
suggestions.Add(dtSelection.Rows(i).Item(1).ToString())
End If
Next
txtSelection.AutoCompleteMode = AutoCompleteMode.Suggest
txtSelection.AutoCompleteSource = AutoCompleteSource.CustomSource
txtSelection.AutoCompleteCustomSource = suggestions
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)