If the item is not selected and you know the text then you can do this to get the index. For example. If the listview has 3 items as show below and I am want to know the index of "koolsid" then I can use the code below....
vb Code:
Private Sub Form_Load()
With ListView1
.ListItems.Add Key:="k1", Text:="huxley"
.ListItems.Add Key:="k2", Text:="koolsid"
.ListItems.Add Key:="k3", Text:="LaVolpe"
End With
End Sub
Private Sub CommandButton1_Click()
Dim itm As ListItem, SearchStrg As String
'~~> String, the index of which you want to find
SearchStrg = "koolsid"
With ListView1
Set itm = .FindItem(SearchStrg, lvwText, , lvwPartial)
If Not itm Is Nothing Then
'~~> Display the index
MsgBox itm.Index
End If
End With
Set itm = Nothing
End Sub
Hope this helps...