VB.NET中如何筛选列表框选中项中包含特定单词的内容?
- 内容介绍
- 相关推荐
本文共计152个文字,预计阅读时间需要1分钟。
我尝试过以下方法:如果ListBox1.Items.Contains(myword)那么+如果ListBox1.SelectedIndex==ListBox1.Items.IndexOf(myword)那么+如果ListBox1.SelectedItems.Item(myword)那么+但没有效果。尝试了这种方式,但listbox.i没有变化。
我试过了:>如果ListBox1.Items.Contains(“myword”)那么
>如果ListBox1.SelectedIndex = ListBox1.Items.IndexOf(“myword”)则
>如果ListBox1.SelectedItems.Item(“myword”)那么
但没有效果.
尝试这样的事情, listbox.items物业是 ListBox.ObjectCollection:For Each i As Object In ListBox1.SelectedItems If CStr(i).Contains("myword") Then BackColor = Color.Blue ' Do your logic here, I just used setting the BackColor for a test End If Next
本文共计152个文字,预计阅读时间需要1分钟。
我尝试过以下方法:如果ListBox1.Items.Contains(myword)那么+如果ListBox1.SelectedIndex==ListBox1.Items.IndexOf(myword)那么+如果ListBox1.SelectedItems.Item(myword)那么+但没有效果。尝试了这种方式,但listbox.i没有变化。
我试过了:>如果ListBox1.Items.Contains(“myword”)那么
>如果ListBox1.SelectedIndex = ListBox1.Items.IndexOf(“myword”)则
>如果ListBox1.SelectedItems.Item(“myword”)那么
但没有效果.
尝试这样的事情, listbox.items物业是 ListBox.ObjectCollection:For Each i As Object In ListBox1.SelectedItems If CStr(i).Contains("myword") Then BackColor = Color.Blue ' Do your logic here, I just used setting the BackColor for a test End If Next

