Re-Selecting Items on a ListView


My Application uses a Listview on a Mainform, and a "Edit Item" button, whjich looks at which item is selected and uses its index.

What I'm trying to achieve is that when control returns from the Edit function, the previously selected item is re-selected. But Listviews by default seem to either not highlight the item at all, or it highlights the first item in the list.

I've tried setting up a localvariable on the form, using the OnSelectItem event to record what item the user was looking at, but this is overriden with 0 index. I then moved this to the OnClick event, but doesn't cater for when the user moves the selection using the cursor keys...

Any elegant solutions out there?

Many thanks