4

我试过了:

  1. 如果 ListBox1.Items.Contains("myword") 那么
  2. 如果 ListBox1.SelectedIndex = ListBox1.Items.IndexOf("myword") 那么
  3. If ListBox1.SelectedItems.Item("myword") Then

但没有效果。

4

1 回答 1

2

尝试这样的事情,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
于 2012-11-14T01:32:15.987 回答