In fact i can loop through items of listview and determine items(i) is selected state or not. But i want to ask you is there method similar listview1.currentitem.text for instance.
Printable View
In fact i can loop through items of listview and determine items(i) is selected state or not. But i want to ask you is there method similar listview1.currentitem.text for instance.
i can use :
any other ideas ?Code:Private Sub ListView1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
MsgBox(ListView1.GetItemAt(e.X, e.Y).Text)
End Sub
Use ListView.FocusedItem property
Thanks :rolleyes:
It depends what you mean by current item? My memory of VB6 is hazy now but if I recall correctly this will return the currently selected item?
If that is what you need then FocusedItem is not a reliable method as it is possible that the focused item is not selected (see the MSDN entry for focuseditem for details)
Assuming there is a selected item then MyListView.SelectedItems(0) will return the selecteditem (assuming there is one) in a single selection listview. For a multi-select listview then things are a bit different and again it depends to some extent what you mean by "current item".