Listview: check if an item in current listview 
Author Message
 Listview: check if an item in current listview

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



Mon, 19 Jan 2004 08:27:08 GMT  
 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.



Mon, 19 Jan 2004 08:33:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Checking Checked items in Listview

2. Checking Checked items in Listview

3. change current item for Listview control in eVB

4. Drag an item of Listview to another position of the same ListView

5. changing the background of a listview item in the listview control

6. Listview Control - moving items from one listview to another

7. Listview - Changing color of listview items

8. Checked ListView Items

9. Get all checked items in ListView

10. Determing checked item in ListView

11. ListView HowTO: prevent the user from checking an item

12. How to count the checked ListView items

 

 
Powered by phpBB® Forum Software