how to get Listview Selected Item

若如初见. 提交于 2019-12-13 06:47:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!