Retrieving selected item from a listview

If you have a listview control, and you want someone to be able to double click on a row in the listview, and then open some other form based on the row they click on, here is the code. The trick is to know which column of your list view (assuming it is a multi-column listview) you want to retrieve the value of.

Code example using VB.net:

listview.items(listview.focuseditem.index).subitems(4).text

The will retrieve the value of the 5th column in your listview (remember, listview columns are numbered starting at 0).

This works in a listview double click event.