问题
I have a lisview that I have created that loads information into the program from selected files. I am now trying to add in a search button to the information typed in so that it highlights (selects) the line of code that information is found in (Entire line for both columns) Multiselect is turned on.
The part I am stuck with is if it was a normal listbox I would use selectedindex but with Listview this method does not seem to work and only has selectedIndexCollection or selected items.
If I try something like these they dont seem to work and want more information added
List.SelectedIndexCollection = Lines.text
List.SelectedItems = Lines.text
Edit from Comments:
Private Sub Search_Click(sender As System.Object, e As System.EventArgs)
Handles Search.Click
Do Until List.FocusedItem.text = lines.text
List.FocusedItem = List.Items(0) +1
Loop
End Sub
来源:https://stackoverflow.com/questions/23662463/how-to-get-listview-selected-item