Good call. I will put these changes in place and let you know in a couple days 8)
Main Topics
Browse All Topics
Dim keepplace As Integer
keepplace = lv.SelectedItem.Index
PopList
lv.ListItems(keepplace).Se
This is the code that I use to at a 5 minute interval refresh the items in a listview control. I cannot reproduce the problem but I have complaints that it is happening. Anyone ever run into this problem?
I am unsure as to why an error like that would ever come up. The list is never empty.
Thanks in advance!
-D-
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
If it is possible that your users or (other) application code is removing nodes/rows, you will also experience this error on a situational basis.
You might make your application more resilient by using the key of the node instead of its index. This is analogous to using a recordset bookmark instead of the absoluteposition property.
Quote>
If it is possible that your users or (other) application code is removing nodes/rows, you will also experience this error on a situational basis.
You might make your application more resilient by using the key of the node instead of its index. This is analogous to using a recordset bookmark instead of the absoluteposition property.
</quote>
Absolutely, Can you explain how to do this "using the key of the node instead of its index"
-D-
Key is a property of a node and must be unique within a listview or treeview. It is usually assigned a value when you create the node. The control hashes the key string value and creates a numeric value that is used in a lookup table.
If you can derive some unique value from the row you are adding, it will make your job easier.
==========================
Example:
ListView1.ListItems.Add , "Now", "Now"
ListView1.ListItems.Add , "is", "is"
ListView1.ListItems.Add , "the", "the"
ListView1.ListItems.Add , "time", "time"
iterating through the listitems:
Debug.Print listview1.ListItems(x).Key
Now 1
the 3
time 4
is 2
Business Accounts
Answer for Membership
by: angelIIIPosted on 2006-08-19 at 13:17:40ID: 17349009
> keepplace = lv.SelectedItem.Index
lected = True
lected = True
first ensure/check if you HAVE a selected item:
if lv.SelectedItem is nothing then
'no selected item
keepplace = 0
else
keepplace = lv.SelectedItem.Index
end if
and to ensure the following line does not error out:
on error resume next
lv.ListItems(keepplace).Se
or, if you can be sure the the item (keepplace) is not removed from the list:
if keepplace <> 0 then
lv.ListItems(keepplace).Se
end if