I'm working on a Windows app that has a ListView containing a bunch of items.
When the user clicks on an item, the app displays the item'd details. The
user then has the opportunity to edit these details. The user should click
the Save button after each change, but of course that doesn't always happen.
If the user makes changes and doesn't click Save, the app displays a message
box asking if they'd like to save their changes. This box includes a Cancel
button, and if they click Cancel, I'd like to short-circuit the selection of
the other item and keep the user at the one they were editing.
I can't find a way to do this. I've tried trapping the Click event, then the
MouseDown event and the Validating event and none of them seem to give me a
way to prevent the ListView from selecting the new item. I tried
programmitcally unassigning the handler for the SelectedIndexChanged event,
but that just prevents the details for the new item from showing up - the
ListView still selects the new item.
What do I need to do? Thanks.