I have two listboxs and i want to click on an Item in listbox1, which will contain names of people and once its selected, it will check listbox2 to see if it has any matching names from listbox1 in listbox2. And if it does, I want listbox2 to automatically set the matching item in listbox2 to be selected. How would I do that???
I wrote that but find string is not useful... I was trying to use ListBoxAddress.contains but I'm getting tired and cant get my head around it. Any helps thanks.
Code:
'Whats in listbox1?
Dim Name As String = ListBoxName.SelectedItem.ToString()
'Now does this match or are alike?
Dim index As Integer = ListBoxAddress.FindString(Name)
'If the item was not found in ListBox2 we do this.
If index = -1 Then
MessageBox.Show("Item is not available in ListBox2")
Else
ListBoxAddress.SetSelected(index, True)
End If