
ListView.EnsureVisible near deleted item
Greetings all:
I am kinda new at this, and I inherited this application a few months ago.
I have a sorted ListView control whose collection of ListItems exceeds the
physical lower boundary of the control. When a user manipulates an item in
the list that is beyond that boundary , I would like to keep the item
visible. On MSDN I found out how to do that when I add an item, by using
the EnsureVisible property. However, now I have a problem.
When deleting an item, I would like to EnsureVisible the item just after the
deleted item in the ListView if it exists, or the item just above it
otherwise, if it exists. The collection is indexed by key, as opposed to
index, and the collection is not sorted but the ListView is. An example of
the key is "CHAN24". Is there an easier way to find out the key of the
immediately succeeding or preceding item in the ListView other than getting
the numeric portion of the deleted key with Val( ), and then adding or
subtracting from it, doing a bunch more type conversions etc., and checking
to see if that key even exists? And if that is what I have to do, could
someone please tell me how to test for the existence of a key. I know how
to set up the loop and all, but not how to simply check for the existence of
the key once inside the loop.
Thank you,
Clark