
Listview: check if an item in current listview
Quote:
> An item sometimes is in current view, but sometimes not. How
to check?
> I tried: If Not listview1.ListItems("MyKey") Is Nothing
Then...
> but not working.
> help please. Thank you.
> Shao
Public Function ItemInListView(ByVal sKey As String, ByVal oList
As ListView) As Boolean
Dim oItem as ListItem
On Error Resume Next
Set oItem = oList.ListItems(sKey)
On Error Goto 0
ItemInListView = Not(oItem Is Nothing)
End If
One caution, though, you can't use keys that look like
numeric--such as "1"--the list view will lookup the item at
index 1 instead.